Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: URGENT: sql group by clause has stopped working
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