I need to optimise the following query, can anyone help? I know it's the Not Exists part that is causing the problem as it is doing a massive table scan, but I'm new to this, can anyone give any advice?
select count(*)
from Job j
where company = 'A'
and branch = 'Branch123'
and engineerNumber = '000123'
and ID > 60473
and not exists(
select JobNumber, Company, Branch
from OutboundEvents o
where o.JobNumber = j.JobNumber
and o.branch = j.branch
and o.company = j.company
and o.Formtype = 'CompleteJob')