I am selecting all records that are duplicates based on any given record (vs simply selecting which field(s) have duplicate records using:
select T1.SN,T1.C,T1.S, T2.cnt
from LS T1
join (
Select SN,C,S,Count(*) as cnt from LS
where (C in ('M','B','Q','SI','X') and S='N') group by SN having count(*)>1
) as T2 on T1.SN=T2.SN and (T1.C in ('M','B','Q','SI','X') and T1.S='N')
I would like to update FieldY to '1' for these selected record.
I tried this and it seemed to work, not sure if it is ideal: