Data Scrub - Duplicate Records I wanted to delete duplicate records in my database, but it's a little more in depth than just one field.

Status  ID
P   150013511822029
P   150022555544009
P   150022551512029
X   150014520920007
R   150022994940022
P   150023488655015


If status = R, the record needs to be removed.
If the status = X (this is a reversal), both the X record and the corresponding P record (with the same ID) need to be removed.

Can someone please help out a newbie? Thank you!
You did not specify your platform but it should be relatively easy to do that:

DELETE FROM mytable
 WHERE Status = 'R'
    OR Status = 'X'
    OR
    (
       Status = 'P'
       AND ID IN (SELECT ID FROM mytable WHERE Status = 'X')
    );


Here are some links you may find helpful:

DELETE

WHERE

IN

AND, OR, NOT