Home  >  Article  >  Database  >  MYSQL delete语句不支持别名的问题_MySQL

MYSQL delete语句不支持别名的问题_MySQL

WBOY
WBOYOriginal
2016-06-01 13:42:421168browse

bitsCN.com
有一个表的数据比较大,然后需要进行关联删除,删除的时候发现如下SQL报错: DELETE FROM test.test1 a WHERE EXISTS (SELECT 1 FROM test.test2 b WHERE a.recordID=b.smsInfoID AND b.receiveTime  报错如下: Error Code: 1064You 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 (SELECT 1 FROM test.test2 b WHERE a.recordID=b.smsInf' at line 1    开始以为是exists的问题,于是更改成in再测试,也报同样错: DELETE FROM test.test1 a WHERE a.recordid IN (SELECT b.smsInfoID FROM test.test2 b WHERE b.receiveTime

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn