且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL 查询错误(SQL 语法错误)

更新时间:2023-01-29 21:28:19

您的 SQL 语句中有一个 unexpected identifier ... 这是因为您正在使用alias zcp 不必要的.使用您拥有的 SQL,无需在 DELETE 子句中对 table 进行别名.>

You have an unexpected identifier in your SQL statement ... This is because you are using the alias zcp unnecessarily. With the SQL that you have, there is no need to alias the table in the DELETE clause.

DELETE FROM zc_products
WHERE products_id IN (SELECT DISTINCT p.products_id FROM zc_products p, zc_products_to_categories pc WHERE 
p.products_id = pc.products_id AND 
pc.categories_id IN (SELECT DISTINCT zcc.categories_id FROM zc_categories zcc WHERE zcc.categories_status = 0));

注意如果您使用 MySQL Workbench 之类的工具 - 它会为您识别问题...让您更轻松地进行故障排除.

NOTE If you used a tool like MySQL Workbench -- It would identify the problem for you ... Allowing you to troubleshoot more easily.