9 Replies Latest reply on Jan 27, 2018 3:01 PM by David Smith

    HELP IN SQL QUERY

    zabs

      I want to add ip address field in this query. please help.

       

      SELECT

      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 UpEventTime,

       

      Nodes.Caption,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 (StartTime.EventType = 1)

       

       

       

      ORDER BY eventtime desc