Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Help
Hi, Paul.
Even though you know that only one row is going to be returned because of the join conditions, you still need to use a 'GROUP BY' in this case. You still are referencing a non-aggregated field alongside an aggregated field. So even though you may not think 'grouping' makes sense because the select should only return 1 row, it still has to be included.
select sum(VAL), VAL1
from TABLE1, TABLE2
where ...
group by VAL1;
HTH,
-Jeff Guttadauro
On Fri, 7 May 1999 10:41:50 +0100, "Paul Davies" <cobalt_at_dircon.co.uk> wrote:
>If I have a function that used an aggregate query:
>
>select sum(VAL), VAL1
>
>from TABLE1,TABLE2 where..
>
>but there only one row of VAL1 will be returned because of the join, how can
>I write this query so Oracle does not keep giving me an error because of the
>combination of the aggregate function and VAL1?
>
>Help appreciated
>
>Paul
>
>
Received on Fri May 07 1999 - 08:56:15 CDT
![]() |
![]() |