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: ORA-00979: not a GROUP BY expression??

Re: ORA-00979: not a GROUP BY expression??

From: Jim Lyons <jlyons_at_weblyons.com>
Date: 5 Jul 2002 09:35:43 -0700
Message-ID: <e67857c9.0207050835.1127dbdd@posting.google.com>


smithesh_kollara_at_hotmail.com (Smithesh Kollara) wrote in message news:<4b9ec61b.0207042211.6419c33a_at_posting.google.com>...
> SELECT
> R.StorerKey AS StorerKey,
> RD.Lottable03 AS Customer,
> RD.Lottable07 as CustomerGroup,
> R.TruckNo AS TruckNo,
> R.TruckType AS TruckType,
> max(RD.Lottable05) AS ReceiptDate,
> R.ReceiptKey AS ReceiptKey,
> RD.SKU AS SKU,
> SKU.DESCR AS Descr,
> sum(RD.QtyExpected) as Expected,
> sum(RD.QtyReceived) as Recieved,
> sum(RD.QtyReceived * SKU.STDCube) as Volume,
> RD.Lottable02 as COrigin,
> RD.Lottable04 as CargoType,
> RD.Lottable06 as RefNo
> FROM
... rest of very long SQL statement deleted

> 1.What is wrong with using "sum" in that particular postion??Send me
> links to support this query.

If you use aggregate functions like 'sum' and 'max' you must use the GROUP BY clause and group by all columns in the SELECT clause that are not aggregated. You can try create a table with this aggregate data in it or using a sub-select in the FROM clause.


Jim Lyons
DBA
UT Austin Received on Fri Jul 05 2002 - 11:35:43 CDT

Original text of this message

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