Hmm, actually, this may not be solved. A further investigation showed that this select statement returns not the row with the highest revision number, but instead the earliest rows (those with the lowest revision numbers) with a new field showing the highest revision number. Here's that table from above again, but this time with the id field:
mysql> select filename, path, revision, id from repos;
+---------------------------+-------------------------------+
| filename | path | revision | id
+---------------------------+---------------------------------------+----------+
| Whitby Chamber Emails.txt | /daytime tv/ | 1 | 8
| Whitby Chamber Emails.txt | /daytime tv/ | 2 | 9
| 2361853 EPO inv.pdf | /daytime tv/ | 1 | 10
| 2361853 EPO inv.pdf | /daytime tv/ | 2 | 11
+---------------------------+-------------------------------------------+
So I really want my select statement to return rows 9 and 11. Instead, I get:
mysql> select id, filename, max(path), max(revision) from repos group by filename;
+----+---------------------------+-------------------------------------+
| id | filename | max(path) | max(revision) |
+----+---------------------------+-------------------------------------+
| 10 | 2361853 EPO inv.pdf | /daytime tv/ | 2 |
| 8 | Whitby Chamber Emails.txt | /daytime tv/ | 2 |
+----+---------------------------+-------------------------------------+
It's returning the wrong rows with the right revision number. This is a partial solution, since I can then easily take that revision number and find the right row. But is it possible to do this in one query?
Thanks!
Aaron.