Home » SQL & PL/SQL » SQL & PL/SQL » Multilevel subtotal of columns (Toad 9.1, Oracle 10g)
Multilevel subtotal of columns [message #334052] Tue, 15 July 2008 05:54 Go to next message
yogeshyl
Messages: 50
Registered: October 2007
Location: Silvassa
Member
In the below given query, i want to display the subtotal of the following columns
1)(PRI_QTY_BU/IU_MAX_LOOSE_1)RQTY,
2)((PRI_QTY_BU/IU_MAX_LOOSE_1)*CGCV_COST_1)RMVALUE

Kindly suggest how could i do this?

SELECT DISTINCT PRWD_WO_NO PWO_NO,
PRI_ITEM_CODE,
ITEM_NAME,
(PRI_QTY_BU/IU_MAX_LOOSE_1)RQTY,
((PRI_QTY_BU / IU_MAX_LOOSE_1) * CGCV_COST_1) RMVALUE
FROM OT_PR_ITEM,
OS_COST_GROUP_CURR_VAL,
OM_ITEM,
OM_ITEM_UOM,
OT_PR_WO_DETAIL
WHERE PRI_ITEM_CODE = CGCV_ITEM_CODE
AND PRI_ITEM_CODE = ITEM_CODE
AND PRI_ITEM_CODE = IU_ITEM_CODE
AND PRWD_SYS_ID = PRI_PRWD_SYS_ID
AND CGCV_COST_GROUP_CODE = 'CGSIL001'
GROUP BY PRI_PRWD_SYS_ID,
PRWD_WO_NO,
PRI_ITEM_CODE,
ITEM_NAME,
CGCV_COST_1,
PRI_QTY,
PRI_QTY_LS,
PRI_QTY_BU,
IU_MAX_LOOSE_1
ORDER BY PRWD_WO_NO


Yogesh
Re: Multilevel subtotal of columns [message #334053 is a reply to message #334052] Tue, 15 July 2008 05:56 Go to previous message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter).
Use the "Preview Message" button to verify.

Maybe using SUM function will help to get total.

Regards
Michel

[Updated on: Tue, 15 July 2008 05:57]

Report message to a moderator

Previous Topic: Row to column conversion
Next Topic: Oracle 9i Before insert trigger is not working
Goto Forum:
  


Current Time: Tue Dec 06 08:16:14 CST 2016

Total time taken to generate the page: 0.11072 seconds