paulj
paulj

Reputation: 331

Combining disparate sql queries in sql server

I have a table, tableA, with 3 rows and 2 columns of data that I need using specific criteria. I have another table, tableB, with 1 row and 3 columns of data that I need using specific criteria. The tables have nothing in common, no joins, etc.

I want the following result set returned:

t=table, r=row, c= column

tAr1c1,tAr1c2,tBr1c1,tBr1c2,tBr1c3
tAr2c1,tAr2c2,tBr1c1,tBr1c2,tBr1c3
tAr3c1,tAr3c2,tBr1c1,tBr1c2,tBr1c3

I investigated union, but that is not it. Is this more a stored procedure than a sql statement? Almost Cartesian product?

Upvotes: 1

Views: 91

Answers (1)

Stefano Zanini
Stefano Zanini

Reputation: 5916

If there's no relationship between the two tables, you have to use a cross join

select  *
from    table1
cross join
        table2

Upvotes: 3

Related Questions