Delete rows with matching multiple columns same table
sql
Solution
delete from MyTable m
where flag = 2050
and exists (
select 1 from MyTable where
MyTable.ssn = m.ssn
and MyTable.lastname=m.lastname
and MyTable.firstname=m.firstname
and MyTable.RF=m.RF
and MyTable.flag <> 2050
)
Problem
Using SQL, I have 5 columns: ssn, lastname, firstname, RF and a flag field. I need to go through this table and where the 4 columns are equal to another row and the value of the flag field in that row is equal to 2050, then delete that 2050 record.