Options

Multiple bulk deletes

I have a table say tmp which 3 columns
tmp:
s1,
s2,
s3
I have a master table

table1:
c1,
c2,
c3,
s1,
s2

I want to delete rows from table1 that has data in tmp. ie delete from table1 join tmp on s1,s2,s3

What is the best way to do?

Currently I have multiple delete statements
delete from table1 where s1 in (select s1 from tmp)
delete from table1 where s2 in (select s2 from tmp)
delete from table1 where s3 in (select s3 from tmp)

I understand that delete optimization happens for the above query but is there a better way to do?

Thanks
Mohan

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file