Tommy Gunn started a great post on this same topic at SystemCenterCentral. I’m adding my own here.
*note: these are WQL queries for ConfigMgr/SCCM collections, but all will translate to T-SQL queries for reporting.
Computers which are joined to a specific domain or workgroup
select * from SMS_R_System where SMS_R_System.ResourceDomainORWorkgroup like "<domainName>%"
Computers which are members of a domain security group
select * from SMS_R_System where SMS_R_System.SystemGroupName = "<domainName>\\<groupName>"
(notice the double backslash)
more to come…
A Collection of ConfigMgr 2012 Collection Queries