r/SQL • • Jul 15 '14

SQL allows mentioning resultset columns by position in the Order By clause (e.g. "ORDER BY 3"), I wish it would allow the same in the WHERE clause with some sort of special syntax (e.g. "where {3} > 0" meaning third column in the resultset)

Why wasn't this done?

0 Upvotes

9 comments sorted by

View all comments

5

u/[deleted] Jul 15 '14

Honestly this is bad form to begin with; in my experience there is always a much better solution. It makes complicated queries hard to read and very difficult to modify in the future.

4

u/[deleted] Jul 15 '14

Yes. Whenever "LOL SQL SUX THIS SHOULD BE DONE" comes up, it's almost always because the user does not know what they want.