Is there a shorter way to write the following query? I want to do it
for each type of ServerRole and there will eventually be many types...
not just exp/prod/q/test/etc...:
select i.User, count(p.serverRole) as 'PROD', count(t.ServerRole) as
'Test', count(q.ServerRole) as 'Q',count(s.ServerRole) as
'SPARE',count(e.ServerRole) as 'EXP'
from dbo.Serverinventory as i
left outer join dbo.ServerInventory as p
on (i.User = p.User and i.recordid = p.recordid and p.ServerRole =
left outer join dbo.ServerInventory as t
on (i.User = t.User and i.recordid = t.recordid and t.ServerRole =
left outer join dbo.ServerInventory as q
on (i.User = q.User and i.recordid = q.recordid and ...