How can I get the permutations of elements from two subqueries in T-SQL?
3 answers
Cartesian union, union without a join condition
select id0.id as id0, id1.id as id1
from id0, id1
Alternatively, you can use the CROSS JOIN syntax if you prefer
select id0.id as id0, id1.id as id1
from id0 cross join id1
you can order your request if you want to get a specific order, from your example it looks like you want
select id0.id as id0, id1.id as id1
from id0 cross join id1 order by id0.id, id1.id
+1
a source to share