Re: Why using "Group By"

From: Larry Coon <>
Date: Thu, 13 Mar 2003 13:43:23 -0800
Message-ID: <>

Bob Badour wrote:

> 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.

Sybase ASE 12.5:

create table mytable (
  a int,
  b int

insert into mytable values (1, 2)
insert into mytable values (1, 3)
insert into mytable values (2, 3)

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

a b
----------- ----------- -----------

          1           2           2 
          1           3           2 
          2           3           1 

Doesn't behave as you described, though I agree it -should- error.

Larry Coon
University of California
and Received on Thu Mar 13 2003 - 22:43:23 CET

Original text of this message