Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!postnews.google.com!e56g2000cwe.googlegroups.com!not-for-mail
From: "Kumar" <ksskumar2000@gmail.com>
Newsgroups: comp.databases.oracle.server
Subject: Re: Any query specialist? you have a challenge
Date: 4 Apr 2006 05:43:29 -0700
Organization: http://groups.google.com
Lines: 28
Message-ID: <1144154609.076092.192420@e56g2000cwe.googlegroups.com>
References: <1144150900.039053.67560@z34g2000cwc.googlegroups.com>
   <1144152371.530641.280980@u72g2000cwu.googlegroups.com>
NNTP-Posting-Host: 220.225.142.21
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1144154614 9247 127.0.0.1 (4 Apr 2006 12:43:34 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 4 Apr 2006 12:43:34 +0000 (UTC)
In-Reply-To: <1144152371.530641.280980@u72g2000cwu.googlegroups.com>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.0 CHNISA01
Complaints-To: groups-abuse@google.com
Injection-Info: e56g2000cwe.googlegroups.com; posting-host=220.225.142.21;
   posting-account=Pu70Fg0AAABTqd8hYiX_f-BWh5xDTx76
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.server:264790

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.

