‎03-05-2012 03:46 PM
Select Top 1000000 (Select Top 1 tblCPlogoninfo.Username From tblCPlogoninfo Group By tblCPlogoninfo.Username, tblCPlogoninfo.Computername Having tblCPlogoninfo.Computername = tblComputers.Computername Order By Count(1) Desc) As Owner, tblComputers.ComputerUnique As Computer, tblADusers.Department, tblADComputers.Location From tblComputers Inner Join tblADComputers On tblComputers.Computername = tblADComputers.Computername Inner Join tblADusers On tblComputers.Userdomain = tblADusers.Userdomain And tblADusers.Username = tblComputers.Username Where (Select Top 1 tblCPlogoninfo.Username From tblCPlogoninfo Group By tblCPlogoninfo.Username, tblCPlogoninfo.Computername Having tblCPlogoninfo.Computername = tblComputers.Computername Order By Count(1) Desc) Like '%.%' And tblComputers.ComputerUnique Not Like '%GLA01%'
Select Top 1000000 tblComputers.ComputerUnique As Computer, tblADusers.Username, tblADusers.Department, tblADComputers.Location From tblComputers Inner Join tblADComputers On tblComputers.Computername = tblADComputers.Computername Inner Join tblADusers On tblADusers.Username = tblComputers.Username And tblADusers.Userdomain = tblComputers.Userdomain Where tblComputers.ComputerUnique Not Like '%GLA01%'
‎03-06-2012 06:01 PM
‎03-06-2012 03:39 PM
Select Top 1000000 tblComputers.Computername, tblComputers.ComputerUnique, tblADComputers.Location, tblADusers.Username, tblADusers.Userdomain, tblADusers.Department, Max(LogonsCount.[Total Logons]) As [Top User Logons] From tblComputers Inner Join (Select Top 1000000 tblCPlogoninfo.Computername, tblCPlogoninfo.Username, tblCPlogoninfo.Domain, Count(tblCPlogoninfo.logontime) As [Total Logons] From tblComputers Inner Join tblCPlogoninfo On tblComputers.Computername = tblCPlogoninfo.Computername Group By tblCPlogoninfo.Computername, tblCPlogoninfo.Username, tblCPlogoninfo.Domain Order By tblCPlogoninfo.Computername, Count(tblCPlogoninfo.logontime) Desc) LogonsCount On LogonsCount.Computername = tblComputers.Computername Left Join tblADusers On tblADusers.Username = tblComputers.Username And tblADusers.Userdomain = tblComputers.Userdomain Left Join tblADComputers On tblComputers.Computername = tblADComputers.Computername Group By tblComputers.Computername, tblComputers.ComputerUnique, tblADComputers.Location, tblADusers.Username, tblADusers.Userdomain, tblADusers.Department Order By tblComputers.ComputerUnique
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now