Tag Info

New answers tagged


Assuming you just want to delete duplicates in books after merging duplicate authors. BEGIN; LOCK books, authors; CREATE TEMP TABLE dupes ON COMMIT DROP AS (SELECT 2 AS dupe, 1 AS org); DELETE FROM books b -- delete duplicate books USING dupes d WHERE b.author_id = d.dupe AND EXISTS ( SELECT 1 FROM books WHERE title = b.title AND ...

Top 50 recent answers are included