MySQL REMOVE FROM AS
I am trying to remove certain types of duplicates from a table that can be selected by this query:
SELECT *
FROM `articles` AS t1
WHERE EXISTS (
SELECT `id`
FROM articles AS t2
WHERE t2.link = t1.link AND
t2.id > t1.id
);
So, I tried these two queries, but they also don't work:
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
);
both return a syntax error.
+3
source to share
2 answers