glyph1
Programmer
- Jun 15, 2007
- 26
Using MSDE MS SQL Server 2000
I have a table named Visitor that has two primary keys (int), Visitor_ID and VisitorVersion_ID.
I am trying to return unique Visitor_ID's that have the most recent version, or in other words the Maximum VisitorVersion_ID value.
My current query:
SELECT Distinct Visitor_ID, SSN, FirstName, LastName, MiddleName, MAX(VisitorVersion_ID) AS Version
FROM Visitor
GROUP BY Visitor_ID, SSN, FirstName, LastName, MiddleName
ORDER BY Visitor_ID
Any help would be greatly appreciated. If you need any additional information please ask I will be monitoring this closely. Thank you!
I have a table named Visitor that has two primary keys (int), Visitor_ID and VisitorVersion_ID.
I am trying to return unique Visitor_ID's that have the most recent version, or in other words the Maximum VisitorVersion_ID value.
My current query:
SELECT Distinct Visitor_ID, SSN, FirstName, LastName, MiddleName, MAX(VisitorVersion_ID) AS Version
FROM Visitor
GROUP BY Visitor_ID, SSN, FirstName, LastName, MiddleName
ORDER BY Visitor_ID
Any help would be greatly appreciated. If you need any additional information please ask I will be monitoring this closely. Thank you!