Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting records that have same ID but different date v
Message
Information générale
Forum:
Oracle
Catégorie:
PL/SQL
Divers
Thread ID:
00494665
Message ID:
00494677
Vues:
21
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform