1
select distinct `sgwc`.`GroupID` AS `GroupID`,`sgwc`.`ComputerID` AS `ComputerID`,`pgp`.`Priority` AS `Priority`,`pgp`.`GroupName` AS `GroupName`,`pgp`.`InstallPolicy` AS `InstallPolicyID`,ifnull((select `isp`.`Name` from `labtech`.`installsoftwarepolicies` `isp` where (`isp`.`ID` = `pgp`.`InstallPolicy`)),'Not Set') AS `InstallPolicy`,`pgp`.`SoftwarePolicy` AS `SoftwarePolicyID`,ifnull((select `isp`.`Name` from `labtech`.`installsoftwarepolicies` `isp` where (`isp`.`ID` = `pgp`.`SoftwarePolicy`)),'Not Set') AS `SoftwarePolicy`,`pgp`.`RebootPolicy` AS `RebootPolicyID`,ifnull((select `rp`.`Name` from `labtech`.`rebootpolicies` `rp` where (`rp`.`ID` = `pgp`.`RebootPolicy`)),'Not Set') AS `RebootPolicy`,(select count(0) from `labtech`.`patchgroupapprovalpolicies` `pgap` where (`pgap`.`GroupID` = `sgwc`.`GroupID`)) AS `ApprovalPolicies`,`pgp`.`ComputerLevelOverride` AS `ComputerLevelOverride` from (`labtech`.`subgroupwchildren` `sgwc` join `labtech`.`patchgrouppolicies` `pgp` on((`sgwc`.`GroupID` = `pgp`.`GroupID`)))