[RESOLVED] trying to do a SUM statement in Crystal Reports
Hello Everyone,
Im trying to do a statement in the "SHOW SQL QUERY" window that will narrow down some data for me. The thing is if I try to enter this statement:
Code:
Select
SHD."CODE", Sum(SHD.BVORDQTY), SHD."SHD_DESCRIPTION", BTL."SUB_CODE", I."ONHAND"
The "Sum(SHD.BVORDQTY)" part gets edited out by crystal reports. How can I make sure that this is included? Its really important for me to have this in the report. Do I need to do this somewhere else?
THANKS!
The rest of the statement if any one needs it:
Code:
Select SHD."CODE", Sum(SHD.BVORDQTY), SHD."SHD_DESCRIPTION", BTL."SUB_CODE", I."ONHAND"
From "TESTER"."SALES_HISTORY_DETAIL" SHD, "TESTER".BOM_TOP_LEVEL BTL, "TESTER".INVENTORY I
WHERE SHD."INVOICE_DATE" = "20071010"
AND BTL."TOP_CODE" = SHD."CODE"
AND BTL."SEQUENCE" = 01
AND I."CODE" = BTL."SUB_CODE"
Group By SHD."CODE", SHD."SHD_DESCRIPTION", BTL."SUB_CODE", I."ONHAND"
Re: trying to do a SUM statement in Crystal Reports
OK I figured out that in order to do a SUM I need to create a SQL EXPRESSION
But when I do a SUM, I need a GROUP BY clause, yet the SQL QUERY wont allow it ... any ideas ? :eek2: :cry:
Re: trying to do a SUM statement in Crystal Reports
Never mind I got it now, in case any one wants to know:
You have to insert a GROUP in order to get GROUP BY to show up in the query box. Then you suppress the DETAIL section in order to display the groupings