Hi,
Have two tables csvtable and customer table with below data.
Objective is to list the data in csv table along with a column if its a duplicate record of customer table (ie,firstname,surname and mobile exactly matches)
declare @csvtable table(id int,firstname varchar(50), surname varchar(50),mobile bigint) insert into @csvtable values(100,'Jose','J',1111111111) insert into @csvtable values(101,'Francis','F',2222222222) insert into @csvtable values(102,'Simon','S',3333333333) select * from @csvtable
ID FirstName SurName Mobile
100 Jose J 1111111111
102 Francis F 2222222222
103 Simon S 3333333333
declare @custtable table(id int,firstname varchar(50), surname varchar(50),mobile bigint)
insert into @custtable values(200,'Jose','J',1111111111)
insert into @custtable values(201,'Thomas','T',4444444444)
insert into @custtable values(202,'Antony','A',5555555555)
select * from @custtable
ID FirstName SurName Mobile
200 Jose J 1111111111
202 Thomas T 4444444444
203 Antony A 5555555555
--Expected Result----
ID FirstName SurName Mobile IsDuplicateCustomer
100 Jose J 1111111111 Y
102 Francis F 2222222222 N
103 Simon S 3333333333 N