Trying to delete records with some conditions but MySQL throwing error:
Error Code: 1093
delete from tbl1
where date(cast(traptime as datetime))< date_sub(current_date, interval 200 day) and
id not in (select max(id) as id from tbl1 group by device_name);