This script shows the number of contracts for persons. Table
Contract has more than 82008 records and
Candidate has about 7978.
Could you please suggest improvements for this script?
select ISNULL(CON.ContractCount, 0) , CAN.PersoonName , ... /* some fields from table Candidate (more than 25) */ from Candidate CAN left join (select PersoonID, COUNT(*) ContractCount from Contract group by PersoonID) CON on CAN.PersoonID = CON .PersoonID where CAN.Type = 11