Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 finding oldest child

Author  Topic 

carleton
Starting Member

3 Posts

Posted - 2009-02-16 : 22:56:01
I have two tables, one has the license information and the child table has the unlock keys containing a licenseId. Each unlock key has an expiration date. I want to get each license once with the latest unlock key's expiration date. How do I do that?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-16 : 23:55:19
Maybe :
Select P.Licenseid,MAX(C.expirationdate)
from Parent P inner join Child C
On P.Licenseid = C.licenseid
Group by P.Licenseid
Order by P.Licenseid
Go to Top of Page
   

- Advertisement -