Sorry, I guess in MySQL you can't run a delete query with the deleting table in a subquery like that. So you'll need to do it in two steps. First to locate the records and store them in a temp table, and then to delete them.
CREATE TEMPORARY TABLE dupes AS
SELECT id FROM usr_custom_layout WHERE id NOT IN (SELECT MIN(id) FROM usr_custom_layout GROUP BY usr, `group`, institution, layout;
DELETE FROM usr_custom_layout WHERE id IN (SELECT id FROM dupes);
Hi Ed,
Sorry, I guess in MySQL you can't run a delete query with the deleting table in a subquery like that. So you'll need to do it in two steps. First to locate the records and store them in a temp table, and then to delete them.
CREATE TEMPORARY TABLE dupes AS
SELECT id FROM usr_custom_layout WHERE id NOT IN (SELECT MIN(id) FROM usr_custom_layout GROUP BY usr, `group`, institution, layout;
DELETE FROM usr_custom_layout WHERE id IN (SELECT id FROM dupes);
Cheers,
Aaron