Help with Custom Report

Hi all,

I have an issue with one of the custom reports. I've been trying to add two columns which are the IP_Address and Status columns but i keep getting invalid code when i attempt to add it. This code is in swql as far as i understand.

Ultimately, it should look something like this:

Node Name, IP, Status, Downtime, Duration

Below is the current code.

SELECT

NodeName AS [Node Name],

  concat(SUBSTRING(tostring(MAX(e.EVENTTIME)),1,4),SUBSTRING(tostring(MAX(e.EVENTTIME)),5,2),

        SUBSTRING(tostring(tolocal(MAX(e.EVENTTIME))),12,8)) as Downtime,

  CONCAT(HOURDIFF(tolocal(max(e.eventtime)),getdate())/24,' Day(s) ',

        HOURDIFF(tolocal(max(e.eventtime)),getdate())-(HOURDIFF(tolocal(max(e.eventtime)),getdate())/24)*24,'h ',

        MINUTEDIFF(tolocal(max(e.eventtime)),getdate())   -   (MINUTEDIFF(tolocal(max(e.eventtime)),getdate())/60)*60,'m') AS Duration


FROM ORION.NODES NODES

INNER JOIN ORION.EVENTS e ON NODES.NODEID = e.NETWORKNODE

WHERE STATUS = 2 and E.Eventtype=1 

GROUP BY NodeName, StatusIcon, DetailsUrl

ORDER BY MINUTEDIFF(tolocal(MAX(E.EventTime)),getdate())  desc

Any help would be greatly appreciated!