我希望协调来自2个不同表的数据,我需要执行连接和substr来创建可用于执行匹配的列。以下单独的查询反映了每个表生成的select语句将INFO : Map 1: -/- Reducer 2: 0/486
INFO : Map 1: -/- Reducer 2: 0/486
INFO : Map 1: -/- Reducer 2: 0/486
INFO : Map 1: -/- Reducer 2: 0/486
(例如sitenn.zonenn
)反映为节点名的匹配值。
site12.zone20
我需要编写一个查询,从一个表中选择另一个表中不存在的所有节点名。
答案 0 :(得分:1)
一种简单的方法:使用[_tableview setRowHeight:UITableViewAutomaticDimension];
[_tableview setEstimatedRowHeight:44];
MINUS
答案 1 :(得分:1)
使用left join
查找它。它比minus
,not in
,not exists
等快。
SELECT a.nodename
FROM (SELECT DISTINCT( regexp_substr(B.node_name, '*site*.*') ) AS nodename
FROM opc_act_messages A,
opc_node_names B
WHERE A.message_group = 'Ebts_Status_Alarms'
AND A.severity <> 2
AND A.node_id = B.node_id
) a
LEFT JOIN
(SELECT 'site'
|| site_id
|| '.zone'
|| zone_id AS nodename
FROM aw_active_alarms
GROUP BY site_id,
zone_id
) b
ON a.nodename = b.nodename
WHERE b.nodename IS NULL
答案 2 :(得分:1)
这会有用吗?
WITH t1
AS (SELECT DISTINCT
(REGEXP_SUBSTR (B.NODE_NAME, '*site*.*')) AS nodename
FROM OPC_ACT_MESSAGES A, OPC_NODE_NAMES B
WHERE A.MESSAGE_GROUP = 'Ebts_Status_Alarms'
AND A.SEVERITY <> 2
AND A.NODE_ID = B.NODE_ID),
t2
AS ( SELECT 'site' || site_id || '.zone' || zone_id AS nodename
FROM aw_active_alarms
GROUP BY site_id, zone_id)
SELECT *
FROM t1
WHERE t1.nodename NOT IN (SELECT nodename FROM t2)