2017-02-22 99 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) ; 

你缺少表這就是名會刪除...有樂趣:-)