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

Home -> Community -> Usenet -> c.d.o.server -> Re: URGENT: sql group by clause has stopped working

Re: URGENT: sql group by clause has stopped working

From: Ranga Chakravarthi <ranga_at_removethis.cfl.rr.com>
Date: Sat, 10 Aug 2002 21:11:37 GMT
Message-ID: <dkf59.143822$s8.2768814@twister.tampabay.rr.com>


There is probably a space or some other character in the data you are querying from. Try this query -- if you are using version below 8i, use rtrim(ltrim(owner))

select trim(owner)
from smith
where job='comp'
and branch = '9'
group by trim(owner)

You can do a GROUP BY without an aggregate function it is equivalent to a DISTINCT
eg,

SQL> select deptno
  2 from emp
  3 where deptno = 20
  4 /

    DEPTNO


        20
        20
        20
        20
        20

SQL> select deptno
  2 from emp
  3 where deptno = 20
  4 group by deptno
  5 /

    DEPTNO


        20

"Daniel Morgan" <dmorgan_at_exesolutions.com> wrote in message >
> That query never worked. You may have run it. It may have returned
something. But it never
> worked as it is written in your original posting.
>
> GROUP BY only has meaning with an aggregating function such as COUNT, SUM,
or AVG.
>
> Daniel Morgan
>
>
Received on Sat Aug 10 2002 - 16:11:37 CDT

Original text of this message

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