-2
SELECT 
 N.NodeID AS NodeID, 
 Interfaces.InterfaceID AS InterfaceID, 
 N.StatusLED AS Status_Icon, 
 N.Caption AS NodeName, 
 Interfaces.StatusLED AS Status_Icon_1, 
 Interfaces.Caption AS Interface_Caption,
 MAX(E.EventTime) AS DownTime,
 Cast(DateDiff(day,MAX(E.EventTime),getdate()) as varchar) + ' Day(s) ' + convert(char(8),dateadd(second,DateDiff(second,MAX(E.EventTime),getdate()),0),14) as Duration
FROM 
Nodes N INNER JOIN Interfaces 
Nodes N INNER JOIN Events E
ON 
N.NodeID = E.NetworkNode
N.NodeID = Interfaces.NodeID
WHERE  
(
   (Interfaces.Status >= '2') AND 
   (
     NOT (Interfaces.NodeID = 0))
)

为什么它不起作用?任何建议

4

1 回答 1

0

我认为您在加入 Try 时遇到问题:

SELECT
N.NodeID AS NodeID, 
Interfaces.InterfaceID AS InterfaceID, 
N.StatusLED AS Status_Icon, 
N.Caption AS NodeName, 
Interfaces.StatusLED AS Status_Icon_1, 
Interfaces.Caption AS Interface_Caption, 
MAX(E.EventTime) AS DownTime, 
Cast(DateDiff(day,MAX(E.EventTime), getdate()) as varchar) + ' Day(s) ' + convert(char(8),dateadd(second,DateDiff(second,MAX(E.EventTime),getdate()),0),14) as Duration 
FROM Nodes N 
INNER JOIN Interfaces
On N.NodeID = Interfaces.NodeID
INNER JOIN Events E
ON N.NodeID = E.NetworkNode
WHERE
( (Interfaces.Status >= '2') AND ( NOT (Interfaces.NodeID = 0)) )
于 2016-12-08T07:59:49.713 回答