User-939850651 posted
Hi jagjit saini,
According to your description, I guess:
In the UniqueId column in the tb2 table, there are multiple duplicate records, and there are also unique records that are not duplicated. What you expect is to find out the records that do not contain duplicates and insert
them into the tb1 table.
If this is the case, have you tried to use group by ... having count(*)=1?
This is my test:
create table tb1(
Code varchar(50) default 'code',
Name varchar(50) default 'Name',
UniqueId int
)
insert into tb1 (UniqueId) values (1),(2),(2),(3),(4),(4),(5),(6),(6)
select Code,Name,UniqueId
into tb2
from tb1
group by Code,Name,UniqueId
having count(*)=1
select * from tb1
select * from tb2
Result:

If I misunderstood something, could you provide more details?
Best regards,
Xudong Peng