2017-02-22 104 views
0

这是工作:无法删除基于关键字的行另一个表

select * FROM Work_Request A where EXISTS (select 1 from Customer B where (B.lsource&128)!=0 and B.license_id=A.license_id) ; 

按照Delete all rows in a table based on another table这个删除也应该工作,但不是给错误:

delete FROM Work_Request A where EXISTS (select 1 from Customer B where (B.lsource&128)!=0 and B.license_id=A.license_id) ; 

错误:

ERROR 1064 (42000): 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 'A where EXISTS ..

...

回答

0

您delete语句应该是这样的

delete A.* FROM Work_Request A 
where EXISTS (select 1 from Customer B where (B.lsource&128)!=0 and B.license_id=A.license_id) ; 

你缺少表这就是名会删除...有乐趣:-)