Re: decode [message #373499] |
Thu, 19 April 2001 14:29 |
decode
Messages: 1 Registered: April 2001
|
Junior Member |
|
|
you will need to decode within your decode statement. one to decode TRANTYPE value and if that evaluates as true one to decode the CONTDTE date >=. also, you can not directly evaluate > or < in decode you must use the sign function which will return -1, 0, or 1 depending upon the evaluation being <, =, or >
SELECT MEMBNO,STIND,CONTTYPE,CONTSRC,INVCDE,
SUM(DECODE(TRANTYPE,'ALL',DECODE(SIGN(CONTDTE-TO_DATE('06-04-1997','MM-DD-YYYY')),-1,0,RELCASH),0))
FROM INVACC
WHERE CONTDTE <= '05-04-1998 00:00:00'
GROUP BY MEMBNO,INVCDE,STIND,CONTTYPE,CONTSRC
|
|
|