Hello Everybody...I would like some help with this query. I want to avoid three index scans on this relatively huge table. Any better ways to do it?SELECT aa.AssessmentId,aa.QuestionId, aa.PointsObtained,o.OrganizationId, o.CountryIdFROM (SELECT AssessmentId, QuestionId, PointsObtained, ROW_NUMBER() OVER(PARTITION BY QuestionId ORDER BY PointsObtained DESC, AssessmentId Desc) as RowNumberFROM AssessmentAnswers) as aa JOIN Assessments AS a ON aa.AssessmentId = a.AssessmentIdJOIN Organizations AS o ON a.OrganizationId = o.OrganizationIdWHERE aa.RowNumber = 1ORDER BY QuestionId
I would appreciate any suggestions. Thanks.