replace duplicate values in a table by null
514439Aug 2 2006 — edited Aug 2 2006Hi
i want to update the table as null where duplicate values are there.
Exmple
name sal
aa 100
bb 100
cc 200
dd 300
is to be updated as
name sal
aa 100
bb
cc 200
dd 300
This query does the job.
update emp a set sal = (select case when a.rowid = min(rowid) then a.sal
else null end from emp b where b.sal=a.sal);
is there any other alterntive mwthod for this.
Thanks in advance.