DELETE FROM dql_account WHERE id IN (
SELECT a.id FROM
( SELECT *FROM dql_account WHERE user_id IN (SELECT user_id FROM dql_account GROUP BY user_id HAVING COUNT(user_id) > 1)
AND id NOT IN (SELECT MIN(id) FROM dql_account GROUP BY user_id HAVING COUNT(user_id)>1)
) a
)
SELECT a.id FROM
( SELECT *FROM dql_account WHERE user_id IN (SELECT user_id FROM dql_account GROUP BY user_id HAVING COUNT(user_id) > 1)
AND id NOT IN (SELECT MIN(id) FROM dql_account GROUP BY user_id HAVING COUNT(user_id)>1)
) a
)