选择Nodes.Caption作为NodeName,选择Interfaces.Caption作为InterfaceName、AlertActive.Acknowledged、AlertActive.AcknowledgedDateTime、AlertActive.TriggeredDateTime,节点连接接口作为Nodes.NodeID = Interface.NodeID的接口,连接ActiveAlerts作为Objects.NodeID = Nodes.NodeID上的对象,Objects.NodeID = Interface.NodeID JOIN AlertActiveObjects作为Alerts.AlertActiveID = Objects.AlertID的警报,其中Alerts.AlertActiveID=2 AlertActiveObjects
发布于 2020-04-24 08:29:12
您正在混合表名和别名表名。
JOIN Interfaces As Interface -- WHERE Interfaces.Availability = 2如果您使用别名,那么在任何地方都可以使用它。
SELECT Nodes.Caption AS NodeName
,Interfaces.Caption AS InterfaceName
,AlertActive.Acknowledged
,AlertActive.AcknowledgedDateTime
,AlertActive.TriggeredDateTime
FROM Nodes
JOIN Interfaces As Interface ON Nodes.NodeID = Interface.NodeID
JOIN ActiveAlerts As Objects ON Objects.NodeID = Nodes.NodeID
AND Objects.NodeID = Interface.NodeID
JOIN AlertActiveObjects AS Alerts ON Alerts.AlertActiveID = Objects.AlertID
WHERE Interface.Availability = 2https://stackoverflow.com/questions/61404094
复制相似问题