Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting top occurrence of master table
Message
 
 
To
26/08/2010 12:50:51
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01478636
Message ID:
01478639
Views:
39
>I have a master table which contains some clients. For each clients, I need to locate the most recent records in the child table. I have done that a few times but cannot remember to cleanest way to do it.

This should get you started
SELECT * FROM ChildTable ct WHERE NOT EXISTS (SELECT 1 FROM ChildTable WHERE pk = ct.pk and SomeDate > ct.SomeDate)
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform