Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003
    Location
    HK
    Posts
    14

    Unanswered: How to use "COMPUTE ON" for multiple columns

    Hi.
    What should be the syntax of my "COMPUTE SUM ON .." for multiple columns. Desired result below:

    Player......Quarter1.......Quarter2......Quarter3. ......Quarter4
    O'Neal.............10.............12.............8 .............12
    Bryant.............12..............8............18 .............11
    Malone..............8..............6............10 ..............6
    Payton..............4.............14.............6 ..............4
    TOTAL..............34.............40............42 .............33

    As you can see I would like to retrieve several columns and getting the sum for each.

    Since this is not a GROUP BY statement, then I guess the ROLLUP function can not be used...

    Thanks!
    Ricky

  2. #2
    Join Date
    May 2003
    Location
    Dublin, Ireland
    Posts
    44

    Re: How to use "COMPUTE ON" for multiple columns

    Try this:

    compute sum label 'TOTAL' of Quarter1, Quarter2, Quarter3,Quarter4 on report
    break on report
    select Player,Quarter1, Quarter2, Quarter3,Quarter4 from mytable;

    Originally posted by spricks
    Hi.
    What should be the syntax of my "COMPUTE SUM ON .." for multiple columns. Desired result below:

    Player......Quarter1.......Quarter2......Quarter3. ......Quarter4
    O'Neal.............10.............12.............8 .............12
    Bryant.............12..............8............18 .............11
    Malone..............8..............6............10 ..............6
    Payton..............4.............14.............6 ..............4
    TOTAL..............34.............40............42 .............33

    As you can see I would like to retrieve several columns and getting the sum for each.

    Since this is not a GROUP BY statement, then I guess the ROLLUP function can not be used...

    Thanks!
    Ricky

  3. #3
    Join Date
    Jul 2003
    Location
    Near Paris France
    Posts
    60
    select sum(Quarter1), sum(Quarter2), sum(Quarter3), sum(Quarter4) From YourTable

    !!!!

Posting Permissions

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