select cc.ownerId, cc.ownerType, cc.contractNbr, cc.autoAudit, cc.autoAuditAction, cc.autoAuditComment, c.claimId, c.readyToAudit, c.claimStatus from tbl_TPM_Claims c with (nolock) inner join tbl_TPM_ClaimContracts cc with (nolock) on cc.claimId = c.claimId and cc.ownerId = c.ownerId and cc.ownerType = c.ownerType and cc.contractNbr != '$MISCELLANEOUS' inner join tbl_TPM_Requests r with (nolock) on r.requestId = cc.requestId and r.ownerId = cc.ownerId and r.ownerType = cc.ownerType inner join tbl_TPM_ClaimantAutoAuditOptions aao with (nolock) on aao.partnerId = c.partnerId and aao.partnerType = c.partnerType and aao.ownerId = cc.ownerId and aao.ownerType = cc.ownerType and aao.assignedContractNbr = r.assignedContractNbr and aao.autoAuditEnabled = 'Y' where c.readyToAudit = 'Y' and c.claimStatus = 'OPEN' and c.ownerId = and c.ownerType = and c.ownerId = 288 and c.ownerType = 'MFR' order by claimId select distinct ownerId, ownerType, claimId from qmd_claimsToProcess where autoAuditAction = 'APPROVE' order by claimId

Short Run