sql query to find latest version of stored document

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lsauravbi
    New Member
    • Mar 2014
    • 8

    sql query to find latest version of stored document

    I have table having column which stores documentid and another column storing the version of document.I want query to find out the only the latest version of document?
    can any one help
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32636

    #2
    Something like this should do you :
    Code:
    SELECT   [DocumentID]
           , MAX([Version]) AS [MaxVersion]
    FROM     [TableName]
    GROUP BY [DocumentID]

    Comment

    Working...