Re: Why using "Group By"

From: Bob Badour <bbadour_at_golden.net>
Date: Thu, 13 Mar 2003 14:57:29 -0500
Message-ID: <pS5ca.65$hR2.8462398_at_mantis.golden.net>


"oferbu" <junkbu_at_hotmail.com> wrote in message news:b9b409f2.0303130207.42f8ab91_at_posting.google.com...
> Hello All,
>
> This is a theoretical question. Why do I need to add the "Group By" in
> the following SQL:

Hi Ofer,

The short answer to your question is to allow inadvisable duplicate rows in the result or in the case of sybase to punish users for typos.

If you have access to sybase (or sqlserver probably), try a query like:

select a, b, count(*) from sometable group by a

They seem to treat the expression as some sort of request for a cross product of sometable with itself just to tie up resources on the server. If the statement gave an error instead, one could at least point out that the redundancy aids compile-time error detection.

Regards,
Bob Received on Thu Mar 13 2003 - 20:57:29 CET

Original text of this message