How do you select only the maximum version of a list of documents that have different versions in SQL?
问题 I have a database table that looks like this: | ID | TITLE | VERSION | | 1 | file1 | 1 | | 2 | file2 | 1 | | 3 | file1 | 2 | | 4 | file2 | 2 | I need an SQL query that will return rows 3 and 4 because they are the latest versions of file1 and file 2. If I run the query on a table that looks like this: | ID | TITLE | VERSION | | 1 | file1 | 1 | | 2 | file2 | 1 | | 3 | file1 | 2 | | 4 | file2 | 2 | | 5 | file3 | 1 | It should return rows 3,4 and 5 because "file3" version1 is the latest version