The MYSQL delete statement does not support aliases.

Source: Internet
Author: User
Tags mysql delete sql error


There is a table with relatively large data, and you need to DELETE the association. When you DELETE the table, you will find the following SQL error: DELETE FROM test. test1 a where exists (SELECT 1 FROM test. test2 B WHERE. recordID = B. smsInfoID AND B. receiveTime <= "00:00:00") limit 1000;
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. recordID = B. smsInf 'at line 1 www.2cto.com thought it was an exists problem, so it was changed to in and then tested, and the same error was reported: delete from test. test1 a WHERE. recordid IN (SELECT B. smsInfoID FROM test. test2 B WHERE B. receiveTime <= "2011-10-09 00:00:00 ") LIMIT 1000; the original MYSQL delete statement does not support aliases! Remove the alias and change the SQL statements reported in the preceding two statements to the following format: DELETE FROM test. test1 WHERE recordid IN (SELECT smsInfoID FROM test. test2 WHERE receiveTime <= "2011-10-09 00:00:00") LIMIT 1000; www.2cto.com delete from test. test1 where exists (SELECT 1 FROM test. test2 WHERE test1.recordID = test2.smsInfoID AND test2.receiveTime <= "00:00:00") LIMIT 1000; no trace of the author Feihong

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.