cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kamranfalahat
Engaged Sweeper
So I made the following report to be used monthly in my company for a desktop inventory:

Select Top 1000000 tblComputers.Computer, tblADComputers.Description, tblComputersystem.Manufacturer, tblComputersystem.Model, tblComputerSystemProduct.IdentifyingNumber, web40ProcessorCapacity.CPU, web40CorrectMemory.Memory, tblADComputers.OperatingSystem, tblComputers.Computername, tblMonitor.MonitorModel, tblMonitor.SerialNumber From tblComputers Inner Join tblADComputers On tblComputers.Computername = tblADComputers.Computername Inner Join tblComputersystem On tblComputers.Computername = tblComputersystem.Computername Inner Join tblComputerSystemProduct On tblComputers.Computername = tblComputerSystemProduct.Computername Inner Join web40ProcessorCapacity On tblComputers.Computername = web40ProcessorCapacity.Computername Inner Join web40CorrectMemory On tblComputers.Computername = web40CorrectMemory.Computername Inner Join tblMonitor On tblComputers.Computername = tblMonitor.Computername Where tblComputersystem.Model Not Like '%Virtual%' And tblADComputers.OperatingSystem Not Like '%Server%' And tblADComputers.OU Not Like '%Armenia%' Order By tblComputers.Computer

Its perfect and it does everything that I want, except one thing. As a part of the requirement, I need to figure out to show the number of monitors connected to every machine. I tried using attributes for tblMonitors, however, I get repetitive rows as many as the number of the monitors... I gave up on that idea. Now I just want a count... If Mr. x has 3 monitors, put a 3 in a column called "whatever". I even tried something like this

Select Top 1000000 computers.Computer, (Select COUNT(*) From tblMonitor As m2 Where m2.Computername = monitors.Computername) As [# of Monitors] From tblMonitor As monitors Inner Join tblComputers As computers On
monitors.Computername = computers.Computername

But again, I get repetitive rows 😞 Help please 🙂
1 ACCEPTED SOLUTION
Hemoco
Lansweeper Alumni
kamranfalahat wrote:
As a part of the requirement, I need to figure out to show the number of monitors connected to every machine.

Please try the report below.

Select tblComputers.Computername, tblComputers.ComputerUnique,
tblComputers.Domain, Count(tblMonitor.MonitorID) As [Monitor Count]
From tblComputers Inner Join
tblMonitor On tblComputers.Computername = tblMonitor.Computername
Group By tblComputers.Computername, tblComputers.ComputerUnique,
tblComputers.Domain
Order By tblComputers.ComputerUnique

View solution in original post

2 REPLIES 2
kamranfalahat
Engaged Sweeper
Perfect!
Thank you very much =D
Hemoco
Lansweeper Alumni
kamranfalahat wrote:
As a part of the requirement, I need to figure out to show the number of monitors connected to every machine.

Please try the report below.

Select tblComputers.Computername, tblComputers.ComputerUnique,
tblComputers.Domain, Count(tblMonitor.MonitorID) As [Monitor Count]
From tblComputers Inner Join
tblMonitor On tblComputers.Computername = tblMonitor.Computername
Group By tblComputers.Computername, tblComputers.ComputerUnique,
tblComputers.Domain
Order By tblComputers.ComputerUnique

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now