sql - Deleting orphans from a table -
i trying clean table there quite few orphaned items.
i approaching checking see if there relationship table looking null values.
delete table1 left join table2 on table1.id = table2.id table2.id null i error left outer join not valid.
i looking suggestions on other ways can delete these orphans broken relationship
try this:
delete table1 not exists (select null table2 table1.id = table2.id)
Comments
Post a Comment