如何在左连接中使用多个子查询来检索连接数据点
How do use multiple subquery within left joins to retrieve connecting data points
您好,我的代码存在一些问题,我不确定缺少关键字是什么意思。
SELECT a.equipment_id, a.equipment_description, a.failure_class,
b.equipment_display_mapping_id,
c.equipment_display_category_name,
d.link_id, d.location_id,
e.rd_attr_txt, e.node_fr_id_num, e.node_to_id_num,
f.node_to_id_num as Previous_node
FROM Equipment_Detail a
LEFT JOIN equipment_display_mapping b on b.equipment_id = a.equipment_id
LEFT JOIN equipment_display_category c on c.equipment_display_category_id = b.equipment_display_category_id
LEFT JOIN equipment_location_mapping d on d.equipment_id = a.equipment_id
LEFT JOIN vw_gis_link e on e.lk_id_num = d.link_id
LEFT JOIN
(
SELECT node_to_id_num
FROM vw_bis_link_details
WHERE node_to_id_num = e.node_fr_id_num
) as f on d.link_id = f.link_id
WHERE 1=1 and a.equipment_type_id = 113;
出现以下错误:
ORA-00905: 缺少关键字
00905. 00000 - “缺少关键字”
*原因:
*行动:
行错误:17 列:7
您在这里使用 link_id 加入,但您只 select node_to_id_num。同样在 Oracle 中,如果我没记错的话,在对表进行别名时不能使用 AS。所以用 f
代替 as f
(
SELECT node_to_id_num
FROM vw_bis_link_details
WHERE node_to_id_num = e.node_fr_id_num
) f on d.link_id = f.link_id
您好,我的代码存在一些问题,我不确定缺少关键字是什么意思。
SELECT a.equipment_id, a.equipment_description, a.failure_class,
b.equipment_display_mapping_id,
c.equipment_display_category_name,
d.link_id, d.location_id,
e.rd_attr_txt, e.node_fr_id_num, e.node_to_id_num,
f.node_to_id_num as Previous_node
FROM Equipment_Detail a
LEFT JOIN equipment_display_mapping b on b.equipment_id = a.equipment_id
LEFT JOIN equipment_display_category c on c.equipment_display_category_id = b.equipment_display_category_id
LEFT JOIN equipment_location_mapping d on d.equipment_id = a.equipment_id
LEFT JOIN vw_gis_link e on e.lk_id_num = d.link_id
LEFT JOIN
(
SELECT node_to_id_num
FROM vw_bis_link_details
WHERE node_to_id_num = e.node_fr_id_num
) as f on d.link_id = f.link_id
WHERE 1=1 and a.equipment_type_id = 113;
出现以下错误:
ORA-00905: 缺少关键字
00905. 00000 - “缺少关键字”
*原因:
*行动:
行错误:17 列:7
您在这里使用 link_id 加入,但您只 select node_to_id_num。同样在 Oracle 中,如果我没记错的话,在对表进行别名时不能使用 AS。所以用 f
as f
(
SELECT node_to_id_num
FROM vw_bis_link_details
WHERE node_to_id_num = e.node_fr_id_num
) f on d.link_id = f.link_id