Argh. No sub-selects in MySQL before version 4.1. That means you can't use the following line...

SELECT * FROM table WHERE id IN (SELECT MAX(id) FROM table)

There's an easy fix for this particular line if you can just grab the first row programmatically (and other solutions with straight SQL), say...

SELECT * FROM table ORDER BY id DESC

... but that doesn't stop you from banging your head on the wall, wondering why the earlier line doesn't work. I never want to see...

Error: java.sql.SQLException: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select max(id) from table)' at line 1, SQL State: 42000, Error Code: 1064

... again.

Of course, my inet host's MySQL version is 4.0.25-nt-max. Thanks, guys. ;^)

Labels: