Count of Models

Here is a query query for count of computer Models.

;with m as (
SELECT
CS.Manufacturer0 as ‘Manufacturer’,
case CS.Manufacturer0
When ‘LENOVO’ then CSP.Version0
else CS.Model0
end as ‘Model’
FROM
dbo.v_R_System_Valid RV
join dbo.v_GS_COMPUTER_SYSTEM CS on RV.ResourceID = CS.ResourceID
join dbo.v_GS_COMPUTER_SYSTEM_PRODUCT CSP on RV.ResourceID = CSP.ResourceID)
Select
M.Manufacturer,
M.Model,
Count(*) as ‘total’
from M
Group by
M.Manufacturer,
M.Model
Order by
M.Manufacturer,
M.Model

Leave a Reply

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