MySQL 从中删除
MySQL DELETE FROM AS
我正在尝试从 table 中删除某种重复项,可以通过此查询选择:
SELECT *
FROM `articles` AS t1
WHERE EXISTS (
SELECT `id`
FROM articles AS t2
WHERE t2.link = t1.link AND
t2.id > t1.id
);
所以我尝试了这两个查询,但它们似乎也不起作用:
DELETE FROM `articles` AS t1
WHERE EXISTS (
SELECT `id` FROM articles AS t2
WHERE t2.link = t1.link AND
t2.id > t1.id
);
&
DELETE FROM t1 USING `articles` AS t1
WHERE EXISTS (
SELECT `id`
FROM `articles` AS t2
WHERE t2.link = t1.link AND
t2.id > t1.id
);
两个return语法错误。
您可以在 from
子句中使用多个表:
DELETE t1
FROM `articles` t1 , `articles` t2
WHERE t2.link = t1.link AND t2.id > t1.id
delete
from articles using articles,
articles a1
where articles.id > a1.id
and articles.link = a1.link
我正在尝试从 table 中删除某种重复项,可以通过此查询选择:
SELECT *
FROM `articles` AS t1
WHERE EXISTS (
SELECT `id`
FROM articles AS t2
WHERE t2.link = t1.link AND
t2.id > t1.id
);
所以我尝试了这两个查询,但它们似乎也不起作用:
DELETE FROM `articles` AS t1
WHERE EXISTS (
SELECT `id` FROM articles AS t2
WHERE t2.link = t1.link AND
t2.id > t1.id
);
&
DELETE FROM t1 USING `articles` AS t1
WHERE EXISTS (
SELECT `id`
FROM `articles` AS t2
WHERE t2.link = t1.link AND
t2.id > t1.id
);
两个return语法错误。
您可以在 from
子句中使用多个表:
DELETE t1
FROM `articles` t1 , `articles` t2
WHERE t2.link = t1.link AND t2.id > t1.id
delete
from articles using articles,
articles a1
where articles.id > a1.id
and articles.link = a1.link