Both of the following queries work and return what I want, but which method is better to use. The one with a Join or the one with a sub-query in the select statment? Select bi.StartDate,bi.BenefitInterestID,0,0,bi2.Interst,0From TSV_BenefitInterest bi left Join @TmpTblInterest tion ti.DateReceived between bI.StartDate and bI.EndDate left join TSV_BenefitInterest bi2on bi.BenefitTypeID = Bi2.BenefitTypeIDwhere ti.BenefitTypeID is nulland bi2.BenefitInterestID = (Select top 1 c.BenefitInterestID from TSV_BenefitInterest c where c.StartDate > bi.Startdate and c.BenefitTypeID = @BenefitTypeID order by c.Startdate asc)--orSelect bi.StartDate,bi.BenefitInterestID,0,0,(SELECT b.Interest FROM TSV_BenefitInterest AS b WHERE b.BenefitInterestID = (Select top 1 c.BenefitInterestID from TSV_BenefitInterest c where c.StartDate > bi.Startdate and c.BenefitTypeID = @BenefitTypeID order by c.Startdate asc)),0From TSV_BenefitInterest bi left Join @TmpTblInterest tion ti.DateReceived between bI.StartDate and bI.EndDate where ti.BenefitTypeID is null
Thanks, Both should work for me, I'm just worried about performance. My set I am working with isn't large enough for me to gage using analysers.