为什么这个SQL:delete from t_bdp_ind_commodity_and_set_sku ss,t_bdp_ind_commodity c where ss.commodity_id = c.commodity_id and c.commodity_id = 3538 and c.commodity_set_id = 8188; 会报这个错误: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 ',t_bdp_ind_commodity c where ss.commodity_id = c.commodity_id and c.commodity_id' at line 1
时间: 2024-01-21 12:18:19 浏览: 70
amz_15_bdp_stepngw_前端美化UI_
这个SQL语句的语法是错误的。在MySQL中,删除语句的语法应该是`DELETE FROM table_name WHERE ...`,而不是`DELETE FROM table_name1,table_name2 WHERE ...`。如果你想要同时删除多个表中的数据,可以使用MySQL的`JOIN`语句,例如:
```
DELETE ss,c FROM t_bdp_ind_commodity_and_set_sku ss
JOIN t_bdp_ind_commodity c ON ss.commodity_id = c.commodity_id
WHERE c.commodity_id = 3538 AND c.commodity_set_id = 8188;
```
这个语句将会删除`t_bdp_ind_commodity_and_set_sku`和`t_bdp_ind_commodity`这两个表中满足条件的记录。
阅读全文