I have two temporary tables #a and #b both filled with integer values. Let's say they both contain 10 rows with values 1-10.
I want to create a third temporary table #c that contains every possible combination of a and b. So it would have 100 rows total with (1,1), (1,2) … (10, 10). How would I go about doing this in SQL. The implementation I'm using is SQL Server 2012.
Best Answer
Cross join will get all combinations