SQL fix

Tell me if i'm wrong