Grand Total column [message #8658] |
Wed, 17 September 2003 13:00 |
Heidi
Messages: 37 Registered: February 2000
|
Member |
|
|
han someone please tell me how How do I add a last column that totals the other four columns? My output looks like this....
Facility Code GATEIN ESTIMATE REPAIR GATEOUT
ATVIECTXA 0 3 0 0
AUBTBPOBA 0 5 0 0
AUFRETMPA 0 8 0 0
BEANRACEF 0 1 0 0
BRITJMSMA 0 11 0 0
etc
and here is my query...
SELECT
/* DM200-Statistical TAR Summary */
DTD.depot as "Facility Code" ,
count (decode(DTD.event_type, 'GATEIN' , 1)) GATEIN ,
count (decode(DTD.event_type, 'ESTIMATE', 1)) ESTIMATE ,
count (decode(DTD.event_type, 'REPAIR' , 1)) REPAIR ,
count (decode(DTD.event_type, 'GATEOUT' , 1)) GATEOUT
FROM
webmethods.dm_transsum_detail DTD,
( select distinct owner_code, recipient from webmethods.dm_partners ) DP
WHERE DTD.receiver = dp.owner_code
AND DTD.event_type in ('GATEIN','GATEOUT','ESTIMATE','REPAIR')
AND /* DP recipient = :partycode */
DP.recipient = 'TRI'
AND DTD.receiver = 'USSFOTRIB'
AND /* DTD.timestamp between :dateBegin and to_date(:dateEnd, 'Dd-Mon-YY')+1 */
DTD.timestamp between '10-SEP-03' and to_date('16-SEP-03', 'Dd-Mon-YY')+1
AND (DTD.rec_status_msg not in ('No Partnership Info Found','No Partnership Info found')
OR DTD.rec_status_msg IS NULL)
AND DTD.rec_status in ('FAILED', 'Failed')
AND rownum <500
GROUP BY
DTD.depot,
DTD.event_type
Many thanks in advance!!
Heidi
|
|
|
|