return 0 with sql query instead of nothing
Posted
by
user1202606
on Stack Overflow
See other posts from Stack Overflow
or by user1202606
Published on 2013-07-03T16:51:22Z
Indexed on
2013/07/03
17:05 UTC
Read the original article
Hit count: 285
sql
|sql-server-2008-r2
How do I return a 0 with as Responses with the PossibleAnswerText if count is 0? Right now it won't return anything.
select
COUNT(sr.Id) AS 'Responses', qpa.PossibleAnswerText
from
CaresPlusParticipantSurvey.QuestionPossibleAnswer as qpa
join
CaresPlusParticipantSurvey.SurveyResponse as sr on sr.QuestionPossibleAnswerId = qpa.Id
where
sr.QuestionPossibleAnswerId = 116
GROUP BY
qpa.PossibleAnswerText
© Stack Overflow or respective owner