I have a table
emp checking saving cd contact type
tom 100.00 100.00 100.00 no x
tom 100.00 100.00 100.00 yes NULL
bob 200.00 200.00 200.00 no z
bob 200.00 200.00 200.00 yes NULL
mike 250.00 100.00 50.00 yes NULL
alice 500.00 210.00 10.00 yes NULL
Expect result
emp checking saving cd contact type
tom 100.00 100.00 100.00 no x
bob 200.00 200.00 200.00 no z
mike 250.00 100.00 50.00 yes NULL
alice 500.00 210.00 10.00 yes NULL
My query
select x.*
from (select *,
row_number() over (partition by emp order by type ) as seqnum
from table1
) x
where seqnum = 1
My goal is to remove duplicate records. If ONLY 2 records with identical and need to remove when contact is ‘yes’. The query remove all ‘No’ and does not look correct. Not sure what do I miss here?
Thank for your help.