Re:Seldomly Used SQL: The Bool Aggregate Functions
by coredog64 on Thursday May 05, 2016 @03:16PM
(#11638946)
"group by 1,2" is for lazy people who never have to support an application in production. It tells the database to group by the columns in the order that they come back in the result and is supported by most engines.
[ Parent
| on HN ]
Re:Seldomly Used SQL: The Bool Aggregate Functions
by ak4g on Thursday May 05, 2016 @11:57PM
(#11641589)
Much like SELECT * or JOIN foo USING(bar), it's the kind of thing that greatly speeds up interactive queries, but shouldn't ever end up in source control.
Re:Seldomly Used SQL: The Bool Aggregate Functions
by JoeCamel on Friday May 06, 2016 @02:12AM
(#11642039)
Why "JOIN foo USING (bar)" shouldn't be used?
Re:Seldomly Used SQL: The Bool Aggregate Functions
by ak4g on Friday May 06, 2016 @08:27PM
(#11647716)
Because with USING, you're precluded from using the full table.column identifier in your JOIN condition. Without that, a future ALTER TABLE that adds another "bar" column to an existing table in the FROM-list will cause a previously-working query to break.
https://gist.github.com/AdamG/1128b86fdafca1e53a4bd5253a6882...