2
查询有什么问题?查询有什么问题?
delete from categories c
left join categories_products cp on cp.category_id = c.id
left join products p on p.id = cp.product_id
left join images i on i.object_id = cp.product_id
where c.id = 3 and i.site_section = 'products'
MySQL返回错误。我试图通过HeidiSQL来执行这个查询。错误未知。
另一个问题,这也将帮助我:如果我没有索引,如何才能级联删除行?
感谢之后添加的别名。但我试图删除'c','cp'和'i'表中的行,并且只从'c'删除行。 – dearmisterrobot 2012-07-26 12:16:21
此链接可能会帮助你:) http://stackoverflow.com/questions/734567/delete-rows-from-multiple-tables – 2012-07-26 12:19:46
谢谢,这个想法很清楚。这是DELETE关键字后的许多别名:) – dearmisterrobot 2012-07-26 12:21:24