select c.claimId, c.claimRef, c.claimINvoice, c.claimDate from tbl_TPM_CLaims c inner join tbl_TPM_ClaimContracts cc on cc.ownerId = c.ownerId and cc.ownerType = c.ownerType and cc.claimId = c.claimId and cc.requestId is null where c.statusReasonId = 119 and c.claimRef like 'PRG-%' and c.claimInvoice like 'HST%' and c.claimDescription = 'Legacy Claim' order by c.claimId