Finding computers with two of the same hardware device?

Comments

3 comments

  • Luke Nichols

    Nathan,

    Will a report work or do you need it to be a collection?

    If a report will work you could just do a SQL report. You can query the "HardwareDevices" table to find your graphics cards by searching for fields containing GTX. You could them group by computer name and look for results with more than one.

    Here's a starting point for the SQL report, you could probably get it to show only machines that have more than one by adding a field to count the results and grouping them properly. Sorry, I'm no SQL expert and I don't have the time to delve further into it right now:

    select
    Computers.Name as "Computer Name",
    HardwareDevices.Name
    from Computers, HardwareDevices
    where <ComputerFilter> and HardwareDevices.Name like '%GTX%' and HardwareDevices.ComputerId == Computers.ComputerId

    2
    Comment actions Permalink
  • Nathan Willis

    Thanks Luke, using your starting point here's what I ended up with (just in case some future person wants to do something similar):

     

    select
    Computers.Name as "Computer Name",
    HardwareDevices.Name as "Graphics Card",
    count(*)
    from Computers,
    HardwareDevices
    where (<ComputerFilter> and HardwareDevices.Name like '%GTX%' and HardwareDevices.ComputerId == Computers.ComputerId)
    or (<ComputerFilter> and HardwareDevices.Name like '%Radeon%' and HardwareDevices.ComputerId == Computers.ComputerId)
    GROUP BY "Computer Name"
    HAVING COUNT(*) > 1
    1
    Comment actions Permalink
  • Luke Nichols

    Great work, glad I was able to at least point you in the right direction.

    1
    Comment actions Permalink

Please sign in to leave a comment.