SELECT *
FROM sysman.mgmt$availability_current a
JOIN sysman.mgmt$target_properties b
ON a.target_guid = b.target_guid
WHERE (a.target_type IN ('oracle_database', 'oracle_listener', 'rac_database', 'oracle_emd')
OR (a.target_type='host' AND a.target_name NOT LIKE '%was%'))
AND b.property_name='orcl_gtp_department'
AND b.property_value NOT IN ('HHHHH CCCCC SSSS', 'SAP', 'weblogic')
FROM sysman.mgmt$availability_current a
JOIN sysman.mgmt$target_properties b
ON a.target_guid = b.target_guid
WHERE (a.target_type IN ('oracle_database', 'oracle_listener', 'rac_database', 'oracle_emd')
OR (a.target_type='host' AND a.target_name NOT LIKE '%was%'))
AND b.property_name='orcl_gtp_department'
AND b.property_value NOT IN ('HHHHH CCCCC SSSS', 'SAP', 'weblogic')