Home » SQL & PL/SQL » SQL & PL/SQL » To select specific columns from tables
To select specific columns from tables [message #441214] Fri, 29 January 2010 08:53 Go to next message
venkatsykam
Messages: 2
Registered: January 2010
Junior Member
Hi,
I have a query where my data looks as followswith dummy nos

Account No Serial no Bill Type
12345678 2 Q
12345678 4 F
12345678 3 Q
12345678 1 I
87654321 109 M
87654321 112 M
87654321 104 M
87654321 113 M
87654321 118 M
87654321 119 F
87654321 114 M
87654321 115 M
87654321 117 M
87654321 116 M
87654321 107 M
87654321 105 M
87654321 110 M
87654321 106 M
87654321 108 M
87654321 111 M

Now I need to arrange seriol no in Desc order and I want only teh second most recent row.
Say my required out put should be
Account No Serialno Bill Type
12345678 3 Q
87654321 118 M
Re: To select specific columns from tables [message #441215 is a reply to message #441214] Fri, 29 January 2010 08:55 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you post a working Test case: create table and insert statements along with the result you want with these data then we will work with your table and data.

Before please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel
To select specific columns from tables [message #441217 is a reply to message #441214] Fri, 29 January 2010 09:06 Go to previous messageGo to next message
venkatsykam
Messages: 2
Registered: January 2010
Junior Member
Hi,
I have a query where my data looks as followswith dummy nos

Account No SerialNo Bill Type
12345678 2 Q
12345678 4 F
12345678 3 Q
12345678 1 I
87654321 109 M
87654321 112 M
87654321 104 M
87654321 113 M
87654321 118 M
87654321 119 F
87654321 114 M
87654321 115 M
87654321 117 M
87654321 116 M
87654321 107 M
87654321 105 M
87654321 110 M
87654321 106 M
87654321 108 M
87654321 111 M

Now I need to arrange seriol no in Desc order and I want only teh second most recent row.
Say my required out put should be
Account No Serialno Bill Type
12345678 3 Q
87654321 118 M
Re: To select specific columns from tables [message #441221 is a reply to message #441214] Fri, 29 January 2010 09:41 Go to previous messageGo to next message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
do a google for TOP-N QUERIES.

go to ASKTOMHOME and do the same search.

Kevin
Re: To select specific columns from tables [message #441222 is a reply to message #441217] Fri, 29 January 2010 09:42 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I have a query where my data looks as followswith dummy nos

Where is the create table statement?
Where are the insert statements?
Where is the Oracle version number?
Where is the formatting?

Regards
Michel
Previous Topic: Multiple Cursor with the same name
Next Topic: Split Sting
Goto Forum:
  


Current Time: Sun Dec 04 08:26:19 CST 2016

Total time taken to generate the page: 0.29376 seconds