Re: Why using "Group By"
Date: Thu, 13 Mar 2003 17:05:42 -0500
"Larry Coon" <larry_at_assist.org> wrote in message
> Bob Badour wrote:
> > The short answer to your question is to allow inadvisable duplicate rows
> > 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.
> > the statement gave an error instead, one could at least point out that
> > 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.
Try it on a table with a few million more rows, and you will see what I mean. Received on Thu Mar 13 2003 - 23:05:42 CET