Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Any query specialist? you have a challenge

Re: Any query specialist? you have a challenge

From: Kumar <ksskumar2000_at_gmail.com>
Date: 4 Apr 2006 05:43:29 -0700
Message-ID: <1144154609.076092.192420@e56g2000cwe.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US