Home » SQL & PL/SQL » SQL & PL/SQL » result set
result set [message #7341] Thu, 05 June 2003 12:16 Go to next message
MM
Messages: 27
Registered: July 2002
Junior Member
Hi,

I have to join two tables to get data. I will be getting multiple rows based on the predicate used and i need only the latest row not all of them.

Thanks in advance.

MM
Re: result set [message #7343 is a reply to message #7341] Thu, 05 June 2003 12:34 Go to previous messageGo to next message
Todd B
Messages: 1
Registered: June 2003
Junior Member
If your query currently returns a fairly small number or rows, then:

select *
  from (< your query > order by date_column desc)
 where rownum <= 1;


otherwise:

< your query >
  where date_column = (select max(date_column)
                         from < your query >);
Re: result set [message #7344 is a reply to message #7343] Thu, 05 June 2003 12:38 Go to previous message
MM
Messages: 27
Registered: July 2002
Junior Member
Thanks Todd.
I did the first one and now i can use the second one too if needed.
Previous Topic: How to SELECT data from the table with user-defined type through DATABASE LINK remotely
Next Topic: exists clause
Goto Forum:
  


Current Time: Fri Apr 26 12:24:51 CDT 2024