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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Help

Re: SQL Help

From: <jeff109_at_NOSPAM.netscape.net>
Date: Fri, 07 May 1999 13:56:15 GMT
Message-ID: <3732ef22.3147235@news>


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

Original text of this message

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