3 Replies Latest reply on Feb 17, 2012 8:55 AM by contracer

    Downtime-Uptime

    contracer

      Hi,

      I´m using sql query below to get this data:

      SELECT
          StartTime.EventTime,
          Nodes.Caption,
          Nodes.Location,
          StartTime.Message,
          DATEDIFF(Mi, StartTime.EventTime,
          (SELECT TOP 1
              EventTime
              FROM Events AS Endtime
              WHERE EndTime.EventTime > StartTime.EventTime AND EndTime.EventType = 5
                  AND EndTime.NetObjectType = 'N'
                  AND EndTime.NetworkNode = StartTime.NetworkNode
              ORDER BY EndTime.EventTime)) AS OutageDurationInMinutes

      FROM Events StartTime INNER JOIN Nodes ON StartTime.NetworkNode = Nodes.NodeID
      WHERE link = 1 and  (StartTime.EventType = 1) AND (StartTime.NetObjectType = 'N') AND
      eventtime between dateadd(month, -1, getdate()) and getdate()
      /*
      ORDER BY Nodes.Caption ASC
      */
      order by StartTime.EventTime

       

      How could I change this query to show me the "Uptime" too ?

      Thanks