riceman0
asked on
SQL to select greatest of group?
Hi, I have a table where the primary keys are DocumentID and RevisionNumber. Is there a way to formulate a query in SQL such that it selects all the latest revisions; i.e., the highest revision number of each document group?
Thanks.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Using your field names:
SELECT [Document Group], Max([RevisionNumber]) As MaxRevNumber
FROM YourTableName
GROUP By [Document Group]
SELECT [Document Group], Max([RevisionNumber]) As MaxRevNumber
FROM YourTableName
GROUP By [Document Group]
Open in new window