Symmetric cross join

后端 未结 1 1024
轮回少年
轮回少年 2021-01-21 10:13

I\'m tryng to extract all pair say i,j from each element in a table against each element on the same table, here my query:

select a.Id L,b.id R into         


        
1条回答
  •  春和景丽
    2021-01-21 11:02

    So, just condition the join so that the left side is always equal to or lesser!

        select a.Id L,b.id R
          into #cross
          from MyTable a
    inner join mytable b on a.id <= b.id
    

    0 讨论(0)
提交回复
热议问题