答案 0 :(得分:0)
似乎他们没有关系,所以CROSS JOIN
就是你所需要的:
SELECT *
FROM Table1 t
CROSS JOIN Table2 s
编辑:使用ROW_NUMBER()
:
SELECT tt.loaiphong,ss.col1,ss.col2........
FROM (SELECT t.*,ROW_NUMBER() OVER(ORDER BY (SELECT 1)) as rnk FROM Table1 t) tt
INNER JOIN(SELECT s.*,ROW_NUMBER() OVER(ORDER BY (SELECT 1)) as rnk FROM Table2 s) ss
ON(tt.rnk = ss.rnk)
如果您对两个表中的所有记录感兴趣,而不仅仅是匹配的行,那么请将INNER JOIN
更改为FULL OUTER JOIN
。