How to achieve in DECODE [message #266490] |
Tue, 11 September 2007 00:38 |
Imran_Chennai
Messages: 22 Registered: June 2007 Location: CHN,INDIA
|
Junior Member |
|
|
Hi,
My below query picks record for 7,30 & 90 days old orders,
SELECT DISTINCT TRUNC(SYSDATE-order_date),
DECODE(TRUNC(SYSDATE-order_date),7,'7 DAYS BO',30,'30 DAYS BO',90,'90 DAYS BO','OTHERS') NOTICE
FROM coe_orders ORDER BY NOTICE;
I need to pick records having 7+, 30+ & 90+ days. And categorize the string message like '7+ DAYS BO','30+ DAYS BO',90,'90+ DAYS BO'
The above query is part of select stmt, so i cant put it in seprate IF or CASE, I need to achieve this by decode or anything equivalent within SELECT stmt
Please give your idea
Thanks in advance
Imran
|
|
|
|
|
|
|
|