Quote:
Originally Posted by shammat
Well all the database that I use see this differently. Oracle, PostgreSQL, SQL Server and DB2 throw an error if you have a column in the GROUP BY part that is not part of the SELECT list.
I'd say there it never makes sense.
|
Odd, I just checked MS SQL Server, DB2 and MySQL, and none of them complained.
http :// sqlzoo.net/
Query:
SELECT sum(population)
FROM bbc
GROUP BY region;
The grouping columns are typically wanted in the select list, but once in a while I write queries where I see no use of them. (It has happened, but I can't remember exactly what I did...)