Edits creating correct sql statements for sorted...

tables using direct edits and formula bar.