Duplicate record problem create table #Personel
(
Ad varchar(100)
)

create table #Masa
(
MasaAdi varchar(100)
)

insert into #Personel values('deneme1')
insert into #Personel values('deneme2')
insert into #Personel values('deneme3')

insert into #Masa values('Masa1')
insert into #Masa values('masa2')
insert into #Masa values('masa3')

select Ad,MasaAdi from
(
select ROW_NUMBER() over(partition by MasaAdi order by ID,Ad ) as Sira,ID,Ad,MasaAdi
from (
select newid() as ID,Ad,MasaAdi 
from #Personel
cross join #Masa
)t
) t2 where Sira = 1 order by Ad


it's creating the result as shown below. 

deneme1 - masa2
deneme2 - masa3
deneme1 - masa1 


well,it's to be able to deploy to different tables two times the same personal.

e.g deneme1 - masa2
    deneme1 - masa1


I don't want to do that.I want to do something as shown below.

e.g deneme1-masa2
    deneme2-masa3
    deneme3-masa1


So,I don't want to deploy to different tables two times the same personal.
with 
cte1 as
(
    select *, row_number() over(order by Ad) RowNumber
    from #Personel
),
cte2 as
(
    select *, row_number() over(order by newid()) RowNumber
    from #Masa
)
select cte1.Ad, cte2.MasaAdi
from cte1
    join cte2 on
        cte1.RowNumber = cte2.RowNumber