Home » SQL & PL/SQL » SQL & PL/SQL » Query Needed
Query Needed [message #191973] Sat, 09 September 2006 08:17 Go to next message
sarfraz_attari
Messages: 123
Registered: July 2005
Senior Member
Dear All

I have two field Invoice date and Purchase Qty . I want to display the Output in following format

No of Months Qty
0-6 month 10
7- 12 months 30
13-24 months 50

Can anyone help me with the query

Thanks

Sarfraz
Re: Query Needed [message #191975 is a reply to message #191973] Sat, 09 September 2006 08:40 Go to previous messageGo to next message
JSI2001
Messages: 1016
Registered: March 2005
Location: Scotland
Senior Member
You're kidding right?
How on earth can someone give you an answer with the information you have supplied?

Provide sample data along with what you have already tried.
Re: Query Needed [message #192031 is a reply to message #191975] Sun, 10 September 2006 00:20 Go to previous messageGo to next message
sarfraz_attari
Messages: 123
Registered: July 2005
Senior Member
Dear

Data is like

inv dt pur qty
29-sep-04 10

10-oct-05 20


20-jan-06 30

20-aug-06 50 etc


Re: Query Needed [message #192034 is a reply to message #192031] Sun, 10 September 2006 00:46 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Step 1: Read the first post in the forum
Step 2: Provide create table scripts, insert scripts and example of desired output
Step 3: Reread JSI2001's reply: "...along with what you have already tried."
Re: Query Needed [message #192222 is a reply to message #192031] Mon, 11 September 2006 08:21 Go to previous message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
select decode(inv,'29-sep-04','0-6 month',
                  '20-jan-06','7-12 months',
                  '20-aug-06','13-24 months') inv, qty
from table
where qty in (10,30,50)
/
Previous Topic: SQL Query
Next Topic: To get alternative row from table
Goto Forum:
  


Current Time: Tue Dec 03 18:35:55 CST 2024