DELETE FROM programSchedule
LEFT JOIN program ON programSchedule.pid = program.id
WHERE program.channel_id = 10
我收到此错误:
#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 ‘LEFT JOIN program ON
programSchedule.pid = program.id’ at
line 1
为什么?
最佳答案
您需要指定要从中删除的表.
DELETE programSchedule.*
FROM programSchedule LEFT JOIN program ON programSchedule.pid = program.id
WHERE program.channel_id = 10
注意:由于您要通过program.channel_id进行过滤,因此将连接更改为INNER JOIN
DELETE programSchedule.*
FROM programSchedule INNER JOIN program ON programSchedule.pid = program.id
WHERE program.channel_id = 10