Hi,Good Day,could you please try this..Create table #orders_company1(ordernum int Primary Key,itemdesc varchar(10))Create table #orders_company2(ordernum int Primary Key,itemdesc varchar(10))Insert into #orders_company1Select 1, 'AA'union allSelect 2, 'BB'union allSelect 3, 'CC'union allSelect 4, 'CC'union allSelect 5, 'DD'Insert into #orders_company2Select 1, 'AA'union allSelect 2, 'BB'union allSelect 3, 'CC'union allSelect 10, 'CC'union Select 11, 'DD'select * from #orders_company1select * from #orders_company2;with cte(ordernum,itemdesc)as(select ordernum,itemdesc from #orders_company1union allselect ordernum,itemdesc from #orders_company2)select ordernum,itemdesc,dupcounts,case when dupcounts=1 then 'N' else 'Y' end as Dups from( select ordernum,itemdesc,count(ordernum)as dupcounts from cte group by ordernum,itemdesc)as t drop table #orders_company1drop table #orders_company2