Suppose, I have a table with the following data. I need to be able to select the unique records from this table, on the LogicalHash column. However, I need the select the largest by FileSize. I can't quite figure out the correct
SQL for this. If I didn't have to worry about taking the largest file, I would just do this:
SELECT * FROM files
WHERE FileID in (
SELECT max(FileID) FROM files GROUP BY LogicalHash)
How do pick the largest file? The file size is not going to be unique throughout the table, I can't select based on that. Using cursors sounds like a bad idea. I also need the SQL to be somewhat backwards compatible to MS Access.
View Complete Post