Vinod
Vinod

Reputation: 35

Delete rows out of many where everything is same except one

i am trying to delete row number 1 and 3, which when compared with row number 2, are same except for procurement_type. There are many more cases like this. This is just for an illustration. Please suggest me sql queries for oracle sql.

enter image description here

Upvotes: 0

Views: 42

Answers (1)

Gnqz
Gnqz

Reputation: 3382

Considering your later comment:

DELETE 
  FROM some_table st
 WHERE procurement _type = 'E'
   AND EXISTS (SELECT 1
                 FROM some_table st
                WHERE procurement _type = 'F'
                  AND srn = st.srn
                      ... /* the other columns you want to compare with*/);
                 

Upvotes: 1

Related Questions