Thanks everyone!
Here is a working solution:
(Normalizing the tables as O'K Web Design suggested is also a good design
solution)
Hans-Peter Grimm <[EMAIL PROTECTED]>
[EMAIL PROTECTED] schrieb:
> I am running MySQL 4.0.10 gamma.
> I have records with data:
> id title version
> 1 a 1
> 2 a 2
> 3 b 1
> 4 b 2
>
> How do I select all the records with highest version for each title?
> [...]
Try:
SELECT t1.id, t1.title, t1.version
FROM table_name t1 LEFT JOIN table_name t2
ON t1.title=t2.title AND t1.version<t2.version
WHERE t2.version IS NULL;
[optional: ORDER BY title]
Replace both occurrences of "table_name" with the name of your table.
HTH, Hans-Peter