Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Why using "Group By"

Re: Why using "Group By"

From: Larry Coon <larry_at_assist.org>
Date: Thu, 13 Mar 2003 13:43:23 -0800
Message-ID: <3E70FB7B.288A@assist.org>


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
larry_at_assist.org
and lmcoon_at_home.com Received on Thu Mar 13 2003 - 15:43:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US