View Single Post
  #10 (permalink)  
Old 12-10-09, 04:36
JarlH JarlH is offline
Registered User
 
Join Date: Dec 2008
Location: At work...
Posts: 68
Quote:
Originally Posted by shammat View Post
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...)
Reply With Quote