I want to create cartesian product sql query.But,I'm getting the error.Where I wrong?
alter table #Personel
(
Ad varchar(100)
)
alter table #Masa
(
MasaAdi varchar(100)
)
insert into #Personel values('deneme1'),('deneme2'),('deneme3')
insert into #Masa values('Masa1'),('masa2'),('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
left outer join #Masa on 1=1
) t
) t2 where Sira = 1 order by Ad