Home » SQL & PL/SQL » SQL & PL/SQL » Seelct records with recent Update_Date
Seelct records with recent Update_Date [message #217570] Fri, 02 February 2007 17:36 Go to next message
pradkuamr
Messages: 29
Registered: November 2006
Junior Member
Hi

I am having a set of records as follows in a table
col1,col2, col3(dd/mm/yyyy)
1 abc 1/1/2007
1 def 2/1/2007

2 ghi 1/1/2007
2 3/1/2007

3 jkl 1/1/2007
3 mno 4/1/2007

I would like the output as follows:

col1, col2,col3
1 abc 2/1/2007
2 3/1/2007
3 mno 4/1/2007

(ie with most recent update_dates)

How to implement this in SQL?
Re: Seelct records with recent Update_Date [message #217571 is a reply to message #217570] Fri, 02 February 2007 17:43 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
by using MAX

[Updated on: Fri, 02 February 2007 17:44] by Moderator

Report message to a moderator

Re: Seelct records with recent Update_Date [message #217575 is a reply to message #217570] Fri, 02 February 2007 18:48 Go to previous messageGo to next message
pradkuamr
Messages: 29
Registered: November 2006
Junior Member
I donot think max solves my problem
Re: Seelct records with recent Update_Date [message #217578 is a reply to message #217575] Fri, 02 February 2007 19:43 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
SQL> select col1, col2, col3
  2     from (select col1, col2, col3, dense_rank() over (partition by col1 order by col3 desc) dr
  3             from max_time)
  4  where dr = 1;

      COL1 COL COL3
---------- --- ----------
         1 def 02/01/2007
         2     03/01/2007
         3 mno 04/01/2007
Previous Topic: Parallel Query Died
Next Topic: Nvl( ) Function (Urjent query help)
Goto Forum:
  


Current Time: Sat Dec 10 22:49:21 CST 2016

Total time taken to generate the page: 0.08251 seconds