Find everyone with two or more workstations

SELECT
    CS.UserName0
Into
    #tmp
FROM   
    dbo.v_GS_Computer_system CS
group by
    CS.UserName0
Having
    Count(CS.UserName0) > 1

SELECT
    CS.Name0,
    CS.Manufacturer0,
    CS.Model0,
    CS.UserName0
FROM   
    dbo.v_GS_Computer_system CS,
    #tmp
Where
    #tmp.UserName0 = CS.UserName0
    or CS.UserName0 != Null
Order by
    CS.UserName0,
    CS.Name0,
    CS.Manufacturer0,
    CS.Model0

Drop table #tmp

Leave a Reply

Your email address will not be published. Required fields are marked *