Home » SQL & PL/SQL » SQL & PL/SQL » Getting the first row (merged 5)
Getting the first row (merged 5) [message #385747] Tue, 10 February 2009 23:20 Go to next message
shoowaruno
Messages: 14
Registered: February 2009
Junior Member
Hi everyone.

How do i get the first row of this output?

SSNUM Birthday lntyp Ckdate remaining balance

3315899990 03/18/71 S Aug-13-08 2640
3315899990 03/18/71 S Aug-08-05 2641.97
3315899990 03/18/71 S Oct-28-02 1517.22
3315899990 03/18/71 S May-30-00 301.62
3315899990 03/18/71 S Dec-16-97 138.95
3315899796 07/02/73 S May-31-00 93.06
3315899796 07/02/73 C Aug-19-99 0
3315899796 07/02/73 S Nov-27-97 .52
3315899796 07/02/73 C Dec-29-95 0



I have this code:

select l.ssnum, to_char(to_date(dobth, 'rrmmdd'), 'mm/dd/yy') "Birthday", lntyp, to_char(to_date(ckdte, 'rrmmdd'), 'Mon-dd-yy'), lnamt - ckamt "Remaining Balance"
from LGLOANINFOMF l, rceestaticmf r where l.ssnum = r.ssnum order by l.ssnum, to_date(ckdte, 'rrmmdd') desc;
Re: Getting the first row [message #385753 is a reply to message #385747] Tue, 10 February 2009 23:24 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.

Post DDL for tables.
Post DML for test data.

Post expected/desired results.

ONLY post single post for any single problem

Re: Getting the first row [message #385768 is a reply to message #385747] Tue, 10 February 2009 23:51 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Please dont multi post your questions.please provide us compleate information as directed by the member in your last post.
as BlackSwan said
Quote:
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.

Post DDL for tables.
Post DML for test data.

Post expected/desired results.

ONLY post single post for any single problem

[Updated on: Tue, 10 February 2009 23:52]

Report message to a moderator

Re: Getting the first row [message #385779 is a reply to message #385747] Wed, 11 February 2009 00:43 Go to previous messageGo to next message
srinivasreddy777
Messages: 11
Registered: October 2007
Location: Hyderabad
Junior Member

Post the queries by formatting it and with insert statements to given faster resolutions.

Try to figure it out using the row_number().

select * from 
(select in_v.*,
       row_number() over (partition by in_v.ssnum order by to_date(in_v.mydate || '-99', 'DD-MM-RR')) as rno
 from       
(select l.ssnum, 
      to_char(to_date(dobth, 'rrmmdd'), 'mm/dd/yy') "Birthday", 
      lntyp, to_char(to_date(ckdte, 'rrmmdd'), 'Mon-dd-yy'), 
      lnamt - ckamt "Remaining Balance",
      to_char(ckdte, 'DD-MM') as mydate
from LGLOANINFOMF l, rceestaticmf r 
where l.ssnum = r.ssnum ) in_v) in_v2
where in_v2.rno = 1


Regards
Srinivas
Re: Getting the first row [message #385780 is a reply to message #385747] Wed, 11 February 2009 00:44 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I need only the rows in bold. How should i modify my code?

add "and row is is in bold"

Regards
Michel
Previous Topic: ORA-21560: while size is less than 1 GB for a CLOB
Next Topic: Is it possible to generate a text file from client machine ?
Goto Forum:
  


Current Time: Sat Dec 10 11:11:34 CST 2016

Total time taken to generate the page: 0.10720 seconds