What you need to do is group by certain columns. In this case, for serverName, Dateand Time, for example, this query would return a result like what you expect:
with
Datos as (
select 16 idse, 'LSTKAG72544' serverName, cast('20180928' as date) [DATE], CAST('17:09:59' as time) [TIME], null SQLBrowser, 'Running' W3SVC, null wscsvc
union all
select 17 idse, 'LSTKAG72544' serverName, cast('20180928' as date) [date], CAST('17:09:59' as time) [time], null SQLBrowser, null W3SVC, 'Running' wscsvc
union all
select 18 idse, 'LSTKAG72544' serverName, cast('20180928' as date) [date], CAST('17:09:59' as time) [time], 'Running' SQLBrowser, null W3SVC, null wscsvc
)
select min(idse) idse
, serverName
, [DATE]
, [TIME]
, min(SQLBrowser) SQLBrowser
, min(W3SVC) W3SVC
, MIN(wscsvc) wscsvc
from Datos
group by serverName, [DATE], [TIME];
What you need to do is group by certain columns. In this case, for
serverName
,Date
andTime
, for example, this query would return a result like what you expect: