Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Any query specialist? you have a challenge
Hi,
I tried the select case also.
select
CustNo, case when ((((to_char(sysdate, 'yyyy') - a.year) * 12) - a.month) + to_char(sysdate, 'mm')) between 1 and 3 then sum(NoOfOrders) end as One2Three, case when ((((to_char(sysdate, 'yyyy') - a.year) * 12) - a.month) + to_char(sysdate, 'mm')) between 4 and 6 then sum(NoOfOrders) end as Four2Six, case when ((((to_char(sysdate, 'yyyy') - a.year) * 12) - a.month) + to_char(sysdate, 'mm')) between 7 and 12 then sum(NoOfOrders) end as Seven2Twele from testTable a group by CustNo, month, year
But I am not able to get the required output. Please let me know, how I can get this.
Thanks in advance. Received on Tue Apr 04 2006 - 07:43:29 CDT