执行此查询后:
DELETE from swimming_class as tb1 JOIN (SELECT class_id FROM `swimming_class`
left join swimming_school on swimming_school.school_id = swimming_class.school_id
where swimming_school.school_name is NULL) as temp ON temp.class_id = tb1.class_id
我收到此错误:
1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以获得正确的语法,使用附近'作为tb1 JOIN(SELECT class_id FROM swimming_class left join swim_school on' at line 1
答案 0 :(得分:0)
我认为你真正追求的是以下(SQL Fiddle):
DELETE sc
FROM swimming_class sc
INNER JOIN swimming_school ss ON ss.school_id = sc.school_id
WHERE ss.school_name is NULL