If i understand you well ( i am half asleep ), what you want is a list of titles with the greatest version.
Something like this
+-------+---------+---------+
| title | doc_num | version |
+-------+---------+---------+
| bar | 1234 | 9 |
| foo | 1234 | 7 |
| other | 2121 | 7 |
+-------+---------+---------+
Well if it is right, all what you need is to change your ORDER BY, for a GROUP by.
SELECT title, doc_num, MAX(version) AS version from test GROUP BY titl
+e;
# For this example "test" is the table name
Failure is not an option - it is a privilege reserved for
those who do not try hard enough.