SELECT
n.Caption AS [NodeCaption]
,n.ObjectSubType AS [NodePollingMethod]
,n.IP_Address AS [NodeIP]
,a.IP AS [AgentIP]
,n.NodeID AS [RealNodeID]
,a.NodeId AS [AgentNodeID]
,n.SysName AS [NodeHostName]
,a.Hostname AS [AgentHostName]
,a.AgentGuid
,a.AgentId
FROM Orion.AgentManagement.Agent AS a
LEFT JOIN Orion.Nodes AS n ON n.NodeID = a.NodeId