SQL第二个表中所有行旁边的一个表中的所有行

时间:2022-03-27 14:17:51
Table1:
a
b
c

Table2:
d
e
f

How do I obtain the following results in sql server:=?

如何在sql server中获得以下结果:=?

ad
ae
af
bd
be
bf
cd
ce
cf

These tables have no columns in common. I just want to see all possible combinations of all the rows in both tables.

这些表没有共同的列。我只想查看两个表中所有行的所有可能组合。

3 个解决方案

#1


SELECT *
FROM Table1
CROSS JOIN Table2

#2


CROSS JOIN is what you want:

CROSS JOIN就是你想要的:

SELECT *
FROM Table1
CROSS JOIN Table2

#3


You can use below query to get required output:

您可以使用以下查询来获取所需的输出:

select * from Table1, Table2

#1


SELECT *
FROM Table1
CROSS JOIN Table2

#2


CROSS JOIN is what you want:

CROSS JOIN就是你想要的:

SELECT *
FROM Table1
CROSS JOIN Table2

#3


You can use below query to get required output:

您可以使用以下查询来获取所需的输出:

select * from Table1, Table2

相关文章