Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews.google.com!z34g2000cwc.googlegroups.com!not-for-mail
From: "Kumar" <ksskumar2000@gmail.com>
Newsgroups: comp.databases.oracle.server
Subject: Any query specialist? you have a challenge
Date: 4 Apr 2006 04:41:40 -0700
Organization: http://groups.google.com
Lines: 28
Message-ID: <1144150900.039053.67560@z34g2000cwc.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 1144150906 30372 127.0.0.1 (4 Apr 2006 11:41:46 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 4 Apr 2006 11:41:46 +0000 (UTC)
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: z34g2000cwc.googlegroups.com; posting-host=220.225.142.21;
   posting-account=Pu70Fg0AAABTqd8hYiX_f-BWh5xDTx76
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.server:264782

Hi friends,

I have a table like,

CustNo	NoOfOrders	Month	Year
1	1		2	2006
1	5		1	2006
1	8		8	2005
1	12		6	2005
2	3		12	2005
2	8		3	2006
2	2		1	2006
2	9		10	2005
2	11		11	2005

I need a sql statement to produce a output like,

		(no of orders between this month range------------------------->)
CustNo		1_to_3_month_ago 	4_to_6_months_ago	7_to_12_months_ago
1		6			8			12
2		10			23			0


assume query execution date is today (4th April 2006).  NOT through
PL/SQL.

thanks in advance

