Link to home
Start Free TrialLog in
Avatar of Sujith S
Sujith SFlag for United Arab Emirates

asked on

ROWS NEED TO CONSIDERED AS COLUMUN

hi,

i HAVE THE BELOW CODE AND THE RESULT IS ATTACHED AS IMAGE, NOW I NEED TO GET THE RESULT AS SUBTOTAL +RCMVALUE+PFTAX VALUE
I TRIED TO USE PIVIOT IN TOAD BUT IT SEEMS HARD FOR ME IS THERE ANY ALTERNATE SOLUTION'S FOR THIS
/* Formatted on 2018/03/13 11:40 (Formatter Plus v4.8.8) */
SELECT gh_sys_id, year_month, gh_txn_code, gh_no, gh_supp_code, supp_name,
       subtotal, ited_anly_code_1, t_amt
  FROM ((SELECT gh_sys_id, year_month, gh_txn_code, gh_no, gh_supp_code,
                supp_name, (total - NVL (disc, 0)) subtotal
           FROM ((SELECT   gh_sys_id, TO_CHAR (gh_dt, 'YYYYMM') year_month,
                           gh_txn_code, gh_no, gh_supp_code, supp_name,
                           SUM (gi_fc_act_val) * gh_exge_rate total
                      FROM ot_gr_head JOIN om_supplier
                           ON gh_supp_code = supp_code
                           JOIN ot_gr_item ON gi_gh_sys_id = gh_sys_id
                     WHERE gh_txn_code = 'GC4'
                       AND gh_dt BETWEEN '1-JAN-18' AND '31-JAN-18'
                  GROUP BY (gh_txn_code,
                            gh_dt,
                            gh_supp_code,
                            gh_no,
                            supp_name,
                            gh_exge_rate,
                            gh_sys_id
                           )) a
                LEFT JOIN
                (SELECT   SUM (NVL (ited_net_lc_amt, 0)) disc, ited_h_sys_id
                     FROM ot_gr_item_ted
                    WHERE ited_ted_code IN ('D01', 'DISC')
                 GROUP BY ited_ted_code, ited_h_sys_id) b
                ON gh_sys_id = ited_h_sys_id)
                ) a
       LEFT JOIN
   (SELECT ited_anly_code_1, SUM(ited_net_lc_amt)t_amt, ited_h_sys_id
  FROM ot_gr_item_ted
 WHERE ited_ted_type_code = 'EXP'
 GROUP BY (ited_anly_code_1, ited_h_sys_id))B
 ON ited_h_sys_id=gh_sys_id)
 WHERE GH_SUPP_CODE = 'VF0912'

Open in new window

Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

There is no attachment.

Images of data really doesn't help us much it we need to set up a test case to test things.
ASKER CERTIFIED SOLUTION
Avatar of Sujith S
Sujith S
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial