Query Optimization and Performance Issue

You can try, but it's still in the where clause. How many records does this return?

Select ebf.fkBoxId, ebip.fkMarketingRegionsId, Max(numberofindexpages) as numberofindexpages
FROM [EditionBrief] ebf
JOIN [EditionBriefRegionalIndexPages] ebip
ON ebip.[fkEditionBriefId] = ebf.[EditionBriefId]
where ebf.fkSpecimenId = @BoxCodeS
group by ebf.fkBoxId, ebip.fkMarketingRegionsId

Hi Mike,

It return 5 rows like below

fkBoxId fkMarketingRegionsId numberofindexpages
1217707 6 2
1217707 7 2
1217707 8 2
1217707 9 2
1217707 10 2