Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2007

    Question Unanswered: ResultSet with subtotals

    I need all the records from the Oracle DB with subtotals grouped by say name column. I need the resultset in a cursor to send it to the frontend.
    I can find subtotal using 'sum' and 'group by' fns but how to get all the records in the group along with sums inbetween.


    Name Pt
    H 5
    H 10
    ST 15
    T 5
    ST 5
    R 10
    R 2
    R 3
    ST 15
    GT 35

    ST - Subtotal
    GT - GrandTotal

  2. #2
    Join Date
    Mar 2007
    Use the ROLLUP operation in the grouping clause and GROUPING_ID function in select clause.
    Consult SQL User's Guide and Reference.

Posting Permissions

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