Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need help subtotal based on records in sql

1567114Mar 1 2017 — edited Mar 3 2017

hELLO,

Need help to output Total based on Supplier Data as below:

CREATE TABLE TAB_SUP

(

SUP_NAME VARCHAR2(30),

PAY_DATE DATE,

PAID_MT NUMBER,

CHECK_NUM NUMBER,

INVOICE_NUM NUMBER);

INSERT INTO TAB_SUP

VALUES

(

'ABC','01-JAN-2016',60,1234,9999);

INSERT INTO TAB_SUP

VALUES

(

'ABC','04-JAN-2016',60,1235,9998);

INSERT INTO TAB_SUP

VALUES

(

'DEF','04-JAN-2016',60,1111,9777);

INSERT INTO TAB_SUP

VALUES

(

'DEF','07-JAN-2016',70,1237,9888);

COMMIT;

I need to represent the lines as

Sup_Name      Pay_Date                         Paid_Amt   Check_Num     Invoice_Num

ABC                01-JAN-2016                    60              1234                 9999

ABC               04-JAN-2016                     60              1235                 9998

                                                  Total:120

DEF               04-JAN-2016                     60              1111                  9777

DEF               07-JAN-2016                     70              1237                 9888

                                                   Total:130 

This post has been answered by Frank Kulash on Mar 1 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2017
Added on Mar 1 2017
14 comments
791 views