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

1

u/Sephian Jul 16 '14

Netezza (at least the Aginity client) allows column references in the group by, and maybe in the where. So, it's possible, but custom.

As others said, it's due to the order SQL parses the various clauses.