Making a SQL report to display CPU and RAM but also provide a count of GPUs
I'm using SQL in PDQ inventory to generate a report. I'm trying to provide a count of only one set of data, the Display Adapters (Should be between 0 and 4). So some systems have more than one display adapter and we want that information.
Right now, count is giving us huge numbers, probably counting things I don't want it to.
select
Computers.Name as "Computer Name",
CPUs.Name,
Computers.Memory as "RAM",
HardwareDevices.Name as "Display Adapters",
count(*)
from Computers, CPUs, HardwareDevices
where (<ComputerFilter> and HardwareDevices.Name like '%this%' and HardwareDevices.ComputerID == Computers.ComputerID)
or (<ComputerFilter> and HardwareDevices.Name like '%that%' and HardwareDevices.ComputerID == Computers.ComputerID)
GROUP BY "Computer Name"
These are actually only bring back 0-4 rows. We just want a count of the total rows of both of these and nothing else:
where (<ComputerFilter> and HardwareDevices.Name like '%this%' and HardwareDevices.ComputerID == Computers.ComputerID)
or (<ComputerFilter> and HardwareDevices.Name like '%that%' and HardwareDevices.ComputerID == Computers.ComputerID)
Comments