Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
| Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 15th, 2008, 05:33 AM
Authorized User
 
Join Date: Apr 2007
Location: Silvassa, Dadra & Nagar Haveli, India.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multilevel subtotal of columns

In the below given query, i want to display the subtotal of the following columns
1)(PRI_QTY||'.'||PRI_QTY_LS)RMQTY,
2)(PRI_QTY_BU/IU_MAX_LOOSE_1)RQTY,
3)((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
||'.'
||PRI_QTY_LS) RMQTY,
((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
__________________
Yogesh
 
Old July 15th, 2008, 02:12 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

I don't understand how you could *EVER* get the total or subtotal of this column:
    (PRI_QTY||'.'||PRI_QTY_LS) as RMQTY

It's not a number. It's a string. You can't get the total of a text column.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtotal fields jsims Access 1 November 10th, 2008 11:34 AM
Subtotal yogeshyl SQL Language 1 July 15th, 2008 02:16 PM
Multilevel Grouping with XSLT 2.0 rzegwaard XSLT 2 January 9th, 2008 04:13 PM
Multilevel unlimited subcategory ? atul PHP Databases 0 September 22nd, 2007 12:37 AM
MultiLevel PHP babaloui PHP Databases 10 August 1st, 2004 02:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.