我在下面有两个结果集。
SELECT * FROM `mfw_host`
WHERE host_id IN
(SELECT host_id FROM `latest_tech`
WHERE `nav_node_id` = 213)
SELECT * FROM `mfw_navnode`
WHERE host_id IN
(SELECT host_id FROM mfw_host
WHERE host_id IN (SELECT host_id FROM `latest_tech`
WHERE `nav_node_id` = 213))
我是将两个结果连接在一起......没有加入和联合(因为它们没有连接它们的键......并且每组结果的字段都不同)。
我怎样才能做到这一点?
更新:.. 答案更新见上文..
我想将上面两组的结果加在一起..它们每组返回 5 行,并且每组检索到不同的列号
尝试了一种解决方案:
SELECT
a.*
, b.*
FROM
( SELECT * FROM `mfw_host`
WHERE host_id IN
(SELECT host_id FROM `latest_tech`
WHERE `nav_node_id` = 213)
) AS a
CROSS JOIN
( SELECT * FROM `mfw_navnode`
WHERE host_id IN
(SELECT host_id FROM mfw_host
WHERE host_id IN (SELECT host_id FROM `latest_tech`
WHERE `nav_node_id` = 213))
) AS b
此交叉连接返回太多行