使用delete from 表1 left join 表2 删除指定数据,报错,原因是没指定将要删除的表
1064 - 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 'ot left join xp_order o on ot.order_no = o.order_no where o.draft_no in ('OR2020' at line 2, Time: 0.012000s
原SQL
-- 查询子订单下所有待执行任务
delete from xp_order_task ot left join xp_order o on ot.order_no = o.order_no where o.draft_no in ('OR202010250931221043527507556831') and ot.allocatable = 'Y';
修改为 删除指定表中的数据
-- 删除子订单下所有待执行任务
delete ot from xp_order_task ot left join xp_order o on ot.order_no = o.order_no where o.draft_no in ('OR202010250931221043527507556831') and ot.allocatable = 'Y';
参考