如何合并一行 table

How to join one row on whole table

我有 tables:m 行的区域和 n 行的类别。因此,我需要一个 table,其中区域中的一行连接到类别中的所有行:

region 1    category 1
region 1    category 2
...
region 1    category n
...
region m    category 1
region m    category 2
...

区域 m 类别 n

我的 DBMS 是 HP Vertica。

您正在寻找 cross join:

select r.*, c.*
from regions r cross join
     categories c;

您也可以使用CROSS APPLY

SELECT 
        *
FROM
        regions 
CROSS APPLY
        categories