Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Most efficient Limited select join
Message
De
17/06/2005 07:00:30
 
 
À
16/06/2005 14:15:40
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
01023931
Message ID:
01024237
Vues:
26
Thanks Keith!

>>I have tblLocation as a child table of tblItem. Any item may have several locations over time. I am trying to find the most efficient method of listing all items with only the last location. Any and all help is appreciated.
>
>
>SELECT i.ItemID, l.LocationID
>FROM tblItem i
>     INNER JOIN tblLocation l
>          ON i.ItemID = l.ItemID
>              AND l.timestamp = (SELECT MAX(timestamp)
>                                 FROM tblLocation
>                                 WHERE ItemID = i.ItemID)
>
Thank You

Rollin Burr

Politicians and diapers have one thing in common. They should both be changed regularly, and for the same reason.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform