Simplify SQL