We have a functioning query report which does everything we need it to but 1 thing. I need a way to choose or change what domain it reports on. We do separate reports for different companies that can't have other companies machines on it. Can anyone provide any advice on this issue?
select mc.full_name COMPUTER_NAME, res.DOMAIN_NETBIOS_NAME as DOMAIN_NAME,
(MISSING_MS_PATCHES+MISSING_TP_PATCHES) MISSING_PATCHES_COUNT, string_agg(description, ' || ') PATCHES_LIST , string_agg(cast(aps.patch_id as text), ', ') PATCH_ID_LIST from PMResourcePatchCount rpc inner join ManagedComputer mc on mc.resource_id=rpc.resource_id inner join resource res on res.resource_id=mc.resource_id inner join AffectedPatchStatus aps on aps.resource_id=mc.resource_id inner join PatchDetails pd on pd.patchid=aps.patch_id where mc.managed_status=61 and status_id=202 group by COMPUTER_NAME, DOMAIN_NAME, MISSING_PATCHES_COUNT