Fixup formatting of SQL queries