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: Bob Badour <bbadour_at_golden.net>
Date: Thu, 13 Mar 2003 17:05:42 -0500
Message-ID: <GK7ca.3$XZ2.175153@mantis.golden.net>


"Larry Coon" <larry_at_assist.org> wrote in message news:3E70FB7B.288A_at_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.

Try it on a table with a few million more rows, and you will see what I mean. Received on Thu Mar 13 2003 - 16:05:42 CST

Original text of this message

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