4 ms·
'ORDER BY 2' would work here, but using the named column is a lot nicer.
by jsmith99 4y ago
'ORDER BY 2' would work here, but using the named column is a lot nicer.
- tomjakubowski 4y agoWow, TIL. Great tip for those random one-off queries you have to bash out when investigating a problem.
- zasdffaa 4y agoPlease never let this vile shortcut work its way into your production code.
- sagarm 4y agoI've seen quite a few production queries that use indexes in GROUP BY and ORDER BY; it's quite common. Probably partially because linters/code review/etc are lightweight to nonexistent amongst the analysts/data science types that I tend to work with.
- zasdffaa 4y agoIndexes are used all over for grouping an ordering, I was objecting only to the syntax of ORDER BY <number>