Posted - 05/14/2007 : 21:07:11
| Hi,I have two questions, firstly..
I am hoping there is a way to GROUP BY on a concatenated output like the following decode etc..
DECODE(PRIM_REASN,'','Reasons not entered',PRIM_REASN)
|| ' '
|| ' '
|| TERT_REASN) Downtime_Reasons,
DOWNTIME_WEB.TIMESTAMP>= (SELECT PRODN_SHIFT.START_DATIME
AND PRODN_SHIFT.END_DATIME > sysdate)
TRIM(DOWNTIME_WEB.STATUS_TEXT) = 'STOPPED'
TRIM(DOWNTIME_WEB.WORK_CTR_NAME) = 'PACK2'
ORDER BY DOWNTIME_WEB.EVENT_DUR
I have tried to put the DECODE etc into the GROUP BY statement but I get an error - " not a valid GROUP BY clause"
Secondly, is there a way of modifying value in field A based on the value in field B
Erroneous example follows - in an effort to explain what I want to do (from above):
ie:If PRIM_REASN is null I want EVENT_DUR to be tested to determine the new value for PRIM_REASN.
Except that tthe above won't work and I don't know what the right function/argument should be..
This is my first foray into SQL server, I am trying to migrate some access queries to work with web services and hence Xcelsius.
Edited by - motoflyboy on 05/14/2007 23:15:39