I am trying to run this SQL query
SELECT activity_log.*
from activity_log
where activity_log.id in (
select a2.id
from activity_log as a2
where a2.batch_uuid = activity_log.batch_uuid
order by a2.id desc limit 1
);
I get the error
ERROR 1235 (42000): This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’
I am not sure if an INNER JOIN or another solution is the most effective.
Any help?
3
Answers
"id desc limit 1" would be the same as max(id):
why not:
Since your subquery is just the same table.
MySQL 8.0 solution:
MySQL 5.x solution: