Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deletion with Aggregated Data
WITH dups AS(
select response_id, answer_id, section
from meta_answer
group by response_id, answer_id, section
having count(1) > 1
)
DELETE FROM meta_answer ma
WHERE EXISTS (
SELECT 1
FROM dups
WHERE dups.response_id = ma.response_id
AND dups.answer_id = ma.answer_id
AND dups.section = ma.section
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.