Positional References

SQL Positional References #

I’m personally usually not a big fan of positional references in SQL (I prefer being very explicit in my queries), but there is a time and place for them.

So to order or group by the ordinal field selected (i.e., 1 is the first field selected, 2 is the second, and so on):

SELECT <field_1>, <field_2>
FROM <table>
GROUP BY <integer>
ORDER BY <integer>;