WQL Subset Query

This blog post goes with the Subset Query post. This is the WQL example with a few tips.

 

  • For the positive query don’t return the PC name because of the possibility of duplicate PC Names instead return ResourceID
  • I also like to keep my queries clean of the junk that the SMS wizard-built queries have. I think that the run faster.

 

Below is what positive query would look like.

select distinct SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceIDfromSMS_G_System_ADD_REMOVE_PROGRAMS where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = “Visio 12”

Now the negative query

select distinct SMS_G_System_COMPUTER_SYSTEM.Name from SMS_G_System_COMPUTER_SYSTEM where SMS_G_System_COMPUTER_SYSTEM.ResourceID not in (select distinct SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceIDfromSMS_G_System_ADD_REMOVE_PROGRAMS where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = “Visio 12”)

Hopefully this gives you an insight on how to create and use subset queries.

 

Leave a Reply

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