I have one table Job_Detail_History
, which contains following structure and data:
When i try to delete query using subquery with LIMIT
, NOT IN
,
DELETE FROM job_detail_history where id not in(select id from job_detail_history order by start_time desc limit 2);
it's giving me :
Error Code: 1235. This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
Then i try to find some solution over SO:
i found this one as global solution, which tells to use JOIN
instead of NOT IN
, but in that case they are using select query. So, the query looks like this :
SELECT * from job_detail_history INNER JOIN (SELECT ID FROM job_detail_history order by start_time desc limit 2) as v2 limit 2;
and it will result a new table as result like this :
So, my question is how to handle DELETE
scenario in this case?