I have been working on a query that will identify all JOB objects in client 10 that do not have any statistics. Can anyone please assist me with refining the query to exclude objects that exist under a certain folder and any of its sub-folders?
This example excludes JOB objects in the folder, 1063005, but the query still picks up objects in 1063005's sub-folders. I'm trying to exclude everything that exists under 1063005 and only return JOB objects that do not have statistics.
SELECT OH.OH_IDNR, OH.OH_CLIENT, OH.OH_OTYPE, OH.OH_NAME, AH.AH_NAME, OH.OH_TITLE, OFS.*
FROM OH INNER JOIN OFS
ON OH.OH_IDNR = OFS.OFS_OH_IDNR_O LEFT JOIN AH
ON OH.OH_IDNR = AH.AH_OH_IDNR
WHERE AH.AH_OH_IDNR IS NULL
AND OH_CLIENT = 10
AND OH.OH_OTYPE = 'JOBS'
AND OH.OH_DELETEFLAG = 0
AND OFS.OFS_OH_IDNR_F != '1063005'
AND OFS.OFS_LINK != '1'