Home » SQL & PL/SQL » SQL & PL/SQL » comparing data in the same field and table (pl/sql)
icon6.gif  comparing data in the same field and table [message #328242] Thu, 19 June 2008 08:34 Go to next message
jenlove
Messages: 1
Registered: June 2008
Location: New York
Junior Member
Good Morning Everyone,

I have the following information in a table:

Refno Def_Id Insp_date ver_date
40047 33344 4/20/2000 4/22/2000
40047 39909 6/4/2001 6/5/2001
40047 45677 6/12/2008 2/14/2008
145888 166332 6/8/2008 6/10/2008

I would like the query to look at all the ver_dates within a refno and if the earliest date is before a specified date (could be today's date), then I would like to not have any of those records returned for that refno.

In the above case, since Refno 40047 has 3 entries and the earliest ver_date for Refno 40047 is 4/22/2000, I don't want to return any of those records.

Thank you for any light you can shed on this as I have tried numerous methods with no solution in sight
Re: comparing data in the same field and table [message #328243 is a reply to message #328242] Thu, 19 June 2008 08:37 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>I have tried numerous methods with no solution in sight
Really? I don't see any.

http://www.orafaq.com/forum/t/88153/0/
Please read & follow Posting Guidelines as stated in URL above
Re: comparing data in the same field and table [message #328244 is a reply to message #328242] Thu, 19 June 2008 08:37 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I'd use a NOT EXISTS clause for that I think.
Previous Topic: Cursor_sharing
Next Topic: Trigger for calling same procedure for different column updation in a tabel
Goto Forum:
  


Current Time: Sat Feb 08 17:40:29 CST 2025