以下のクエリで郡別にグループ化し、郡別に並べ替えようとしていますが、うまくいきません。郡別にグループ化して並べ替えるにはどうすればよいですか?
select COUNT(sr.Response) as 'Number Of Responses',
County =
(select qpa.PossibleAnswerText from CaresPlusParticipantSurvey.QuestionPossibleAnswer as qpa
join CaresPlusParticipantSurvey.SurveyResponse as sr1 on qpa.Id = sr1.QuestionPossibleAnswerId
where (sr1.QuestionId = 1 and sr.SurveyId = sr1.SurveyId))
FROM CaresPlusParticipantSurvey.SurveyResponse as sr
where (sr.Response is not null and CAST(sr.Response as int) < 6) and (sr.QuestionId = 8)
Group BY sr.Response, sr.SurveyId
Order by County
以下の結果は、現在のクエリでの現在の結果です。郡ごとにグループ化したいので、4 Alameda 1 Colusa 8 Contra Costa
1 Alameda
1 Alameda
1 Alameda
1 Alameda
1 Colusa
1 Contra Costa
1 Contra Costa
1 Contra Costa
1 Contra Costa
1 Contra Costa
1 Contra Costa
1 Contra Costa
1 Contra Costa