select a.AgentId,
case(select acs.IsConnected
from rmm.tblAgentConnectionStatus acs
where acs.AgentName = a.AgentName)
when 1 then 'True'
when 0 then 'False'
when null then 'False'
end as ConnectionStatus
from Sentilan2.rmm.tblAgent a
order by AgentName asc
select a.AgentId,
case(select acs.IsConn