Let's say the column name that contains file name is FileName
and the column which contains date and time is DateTime
.
SELECT a.*
FROM TableName a
INNER JOIN
(
SELECT FileName, MAX(DateTime) max_date
FROM TableName
GROUP BY FileName
) b ON a.FileName = b.FileName AND
a.DateTime = b.max_Date
THE OUTPUT
╔══════╦══════════════╦══════════════╦════════════╦══════╦═════════════════════╦════════════╗
║ COL1 ║ COL2 ║ FILENAME ║ COL4 ║ COL5 ║ DATETIME ║ COL7 ║
╠══════╬══════════════╬══════════════╬════════════╬══════╬═════════════════════╬════════════╣
║ 12 ║ generaluser1 ║ shared2.txt ║ Shared ║ XP1 ║ 2013-04-04 19:33:03 ║ Checked In ║
║ 13 ║ generaluser2 ║ restdoc3.txt ║ Restricted ║ XP2 ║ 2013-04-04 19:33:28 ║ Checked In ║
║ 14 ║ generaluser2 ║ restdoc4.txt ║ Restricted ║ XP2 ║ 2013-04-04 19:33:36 ║ Checked In ║
╚══════╩══════════════╩══════════════╩════════════╩══════╩═════════════════════╩════════════╝