相关疑难解决方法(0)

如何在SQL中合并2列与所有可能的组合?

这个问题听起来令人困惑,但看看:

这样我们就可以获得第一列(col1):

select distinct maker
from product
Run Code Online (Sandbox Code Playgroud)

第二列(col2):

select distinct type,maker
from product
Run Code Online (Sandbox Code Playgroud)

所以现在我需要从col1和col2获得所有可能的组合.有什么建议吗?

不久,这个:

A f1

B f2
Run Code Online (Sandbox Code Playgroud)

应该成为这样的:

A f1

A f2

B f1

B f2
Run Code Online (Sandbox Code Playgroud)

PS此查询不会返回我需要的内容.

select distinct A.maker, B.type
from product as A
Run Code Online (Sandbox Code Playgroud)

sql merge combinations ansi-sql

2
推荐指数
1
解决办法
780
查看次数

标签 统计

ansi-sql ×1

combinations ×1

merge ×1

sql ×1