多表删除 DELETE t1 FROM .....这里的t1是不是可以删掉啊?
多表删除 DELETE t1 FROM .....这里的t1是不是可以删掉啊?
多表删除 DELETE t1 FROM .....这里的t1是不是可以删掉啊?
2016-10-20
用下面这种写法感觉更好理解一些:
DELETE FROM t1
USING tdb_goods AS t1 JOIN (SELECT goods_id,goods_name FROM tdb_goods GROUP BY goods_name HAVING count(goods_name) >= 2) AS t2 ON t1.goods_name=t2.goods_name
WHERE t1.goods_id > t2.goods_id;
语法如下:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
FROM tbl_name[.*] [, tbl_name[.*]] ...
USING table_references
[WHERE where_condition]
举报