mysql - delete from 和 left Join连在一起怎么用
本文介绍了mysql - delete from 和 left Join连在一起怎么用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
SQL: DELETE FROM task_news as a LEFT JOIN temp_new as b ON a.ID=b.ID WHERE 1 and b.UserID>0
Error: 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 'as a LEFT JOIN temp_new as b ON a.ID=b.ID WHERE 1 and b.UserID>0' at line 1
这个不能连在一起用吗,为什么报这个错,谁能解答一下,非常感谢
解决方案
可以一起用,参见
http://www.mysqltutorial.org/...
你的问题在于,没指定删除a表还是b表数据,MySQL很懵逼。
DELETE
a
FROM
task_news a
LEFT JOIN
temp_new b
ON
a.ID = b.ID
WHERE
b.UserID > 0
这篇关于mysql - delete from 和 left Join连在一起怎么用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文