Results 1 to 3 of 3

Thread: [RESOLVED] trying to do a SUM statement in Crystal Reports

  1. #1

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    32

    Resolved [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"

  2. #2

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    32

    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 ?

  3. #3

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    32

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width