I am trying to set a particular value to the last row in a table, but I’m not sure how to do this with subqueries. I am getting the sid of the last row in the table by
SELECT sid ORDER BY timestamp DESC LIMIT 1
and I want to assign “bar” to the foo column of that sid.
This is what I have so far, but it does not work (#1235 – This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’).
UPDATE table SET foo="bar" WHERE sid IN (SELECT sid ORDER BY timestamp DESC LIMIT 1)
Any ideas?
Thanks!
You don’t need a subquery at all. 🙂