關鍵問題:MySQL不容許在子查詢中使用要刪除的表mysql
DELETE FROM post_activity_user WHERE id IN ( SELECT a.id FROM post_activity_user a LEFT JOIN post_activity_info b ON a.activity_id = b.id WHERE b.enterprise_id = 10000000 AND b.activity_type = 3 )
DELETE FROM post_activity_user WHERE post_activity_user.id IN ( SELECT * FROM ( SELECT a.id FROM post_activity_user a LEFT JOIN post_activity_info b ON a.activity_id = b.id WHERE b.enterprise_id = 10000000 AND b.activity_type = 3 ) ee )