Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting records that have same ID but different date v
Message
General information
Forum:
Oracle
Category:
PL/SQL
Miscellaneous
Thread ID:
00494665
Message ID:
00494677
Views:
22
>>I have a table with say 3 fields--ID, Description, EffectDate. On many records the ID and Description can be the same. The only thing differentiating them is the EffectDate. Out of these duplicates I want only the record with the most recent EffectDate. Is there a way to do this with a SELECT query or am I going to have to loop through a cursor in order to get these results?
>>
>>TIA,
>>George
>
>See if this works:
>
>select fieldlist from mytable where id in (select id, max(effectdate) from mytable group by id)

Thanks for the quick reply Mark. Unfortunately since we're using the IN clause the sub-select would have to be on one value only :(

George
Everything we see or seems
Is but a dream within a dream
- Edgar Allen Poe
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform