加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

mysql – 错误查询:DELETE和LEFT JOIN

发布时间:2020-12-11 23:41:38 所属栏目:MySql教程 来源:网络整理
导读: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 t

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读