Results 1 to 2 of 2

Thread: SQL Sum

  1. #1
    Join Date
    Oct 2003
    Location
    santa clara
    Posts
    25

    Unanswered: SQL Sum

    I have SQL Query below which does not work...

    SELECT
    AROPNFIL."AR_OPN_CUS_NO", AROPNFIL."AR_OPN_APPLY_TO", SUM(AROPNFIL."AR_OPN_AMT1")
    FROM
    "Data2"."AROPNFIL" AROPNFIL
    GROUP BY
    AROPNFIL."AR_OPN_CUS_NO",
    AROPNFIL."AR_OPN_APPLY_TO"
    ORDER BY
    AROPNFIL."AR_OPN_CUS_NO",
    AROPNFIL."AR_OPN_APPLY_TO"

    When I hit OK it tells me that ... ODBC error:[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Column invalid. Must be a group by column: AR_OPN_AMT1 in SELECT LIST.

    Is not the sum() a group by function?

    Please help.

    I'm using an old Crystal Reports 5.0 and Pervasive 2000

    Thanks.

  2. #2
    Join Date
    Jan 2004
    Location
    Jersey, UK
    Posts
    108
    Well the SQL code looks fine to me. Have you tried some other tests like changing the SUM function to MAX (or another aggregate function)? You could also take out the grouping to see if that works. Running some tests like this might help you realise where the problem is.

    Sorry, that's all I can think of.


    Regards - Andy

Posting Permissions

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