Garth just put out some nice blog posts about sub-select queries too. 

http://myitforum.com/myitforumwp/2014/09/25/subselect-wql-query-to-find-pcs-that-do-not-have-either-x86-or-x64-versions-of-software-installed/
 

http://myitforum.com/myitforumwp/2014/09/24/subselect-query-for-configuration-manager-queries-or-collections-wql/
 

http://myitforum.com/myitforumwp/2014/09/18/subselect-query-for-reports-sql/ 

Daniel Ratliff

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of William Jackson
Sent: Wednesday, October 15, 2014 3:09 PM
To: myITforum SMS List ([email protected])
Subject: [mssms] Re: Query for Systems Not in a Certain OU

select * from SMS_R_System where SMS_R_System.ResourceID not in (select 
ResourceID from SMS_R_System where SMS_R_System.SystemOUName = "<OUName>")​


William

From: [email protected] <[email protected]> on behalf 
of Gushue, William <[email protected]>
Sent: Wednesday, October 15, 2014 13:56
To: myITforum SMS List ([email protected])
Subject: [mssms] Query for Systems Not in a Certain OU
  

I am trying to write a query which returns all systems that are not in a 
certain OU, but those systems still get returned.
 
This query works and returns the 32 items it should:
 
select *  from  SMS_R_System where SMS_R_System.SystemOUName = "<OUName>"
 
This query returns 1963 items, but includes the 32 that I don’t want:
 
select *  from  SMS_R_System where SMS_R_System.SystemOUName != 
"OHHLLP.COM/IS/COMPUTERS"
 
Is this query even possible?  Thanks.
 
 
********************************************************************

This e-mail message is privileged, confidential and subject to copyright. Any 
unauthorized use or disclosure is prohibited.

Le contenu du présent courriel est privilégié, confidentiel et soumis à des 
droits d'auteur. Il est interdit de l'utiliser ou de le divulguer sans 
autorisation.

********************************************************************

   

The information transmitted is intended only for the person or entity to which 
it is addressed
and may contain CONFIDENTIAL material.  If you receive this 
material/information in error,
please contact the sender and delete or destroy the material/information.

Reply via email to