SELECT count(*) participantCount, count( distinct r.responseID ) responseCount FROM tbl_CRM_Participants p INNER JOIN tbl_OPR_ClientOperators opr ON opr.operatorId = p.operatorId AND opr.ownerId = p.ownerID AND opr.fsltablecode = p.ownerType AND opr.territoryId in () INNER JOIN tbl_CRM_ParticipantSurveyCodes psc ON psc.participantID = p.participantID AND psc.ownerID = p.ownerID AND psc.ownerType = p.ownerType LEFT OUTER JOIN tbl_SVY_Responses r ON r.responseID = psc.responseID AND psc.approvalStatus = 'A' AND r.ownerID = psc.ownerID AND r.ownerType = psc.ownerType WHERE p.marketingActivityID = AND p.ownerID = AND p.ownerType = SELECT q.questionID, q.questionPrompt, sq.sortOrder, q.maxSelections, q.archiveFlag, q.archiveDate, sq.answerRequired, sq.deactivatedFlag, sq.deactivatedDate, sq.dateAdded FROM tbl_SVY_Questions q INNER JOIN tbl_SVY_SurveyQuestions sq ON sq.questionID = q.questionID AND sq.ownerID = q.ownerID AND sq.ownerType = q.ownerType INNER JOIN tbl_CRM_SurveyLinks sl ON sl.surveyID = sq.surveyID AND sl.ownerID = sq.ownerID AND sl.ownerType = sq.ownerType WHERE sl.marketingActivityID = AND sl.surveyRole = AND sl.ownerID = AND sl.ownerType =

#attributes.territoryIDs#

#Now()#

SELECT c.choiceID, c.selectionValue, count(distinct a.responseID) responseCount FROM tbl_SVY_Responses r INNER JOIN tbl_CRM_ParticipantSurveyCodes psc ON psc.responseID = r.responseID AND psc.ownerID = r.ownerID AND psc.ownerType = r.ownerType AND psc.approvalStatus = 'A' INNER JOIN tbl_CRM_Participants p ON p.participantID = psc.participantID AND p.ownerID = psc.ownerID AND p.ownerType = psc.ownerType INNER JOIN tbl_OPR_ClientOperators opr ON opr.operatorId = p.operatorId AND opr.ownerId = p.ownerID AND opr.fsltablecode = p.ownerType AND opr.territoryId in () INNER JOIN tbl_SVY_SurveyQuestions sq ON sq.surveyID = r.surveyID AND sq.ownerID = r.ownerID AND sq.ownerType = r.ownerType INNER JOIN tbl_SVY_Choices c ON c.questionID = sq.questionID AND c.ownerID = sq.ownerID AND c.ownerType = sq.ownerType LEFT OUTER JOIN tbl_SVY_Answers a ON a.choiceid = c.choiceID AND a.ownerID = c.ownerID AND a.ownerType = c.ownerType AND a.responseID = r.responseID WHERE p.marketingActivityID = AND p.ownerID = AND p.ownerType = AND c.questionID = GROUP BY c.choiceID, c.selectionValue SELECT count(*) questionResponseCount FROM tbl_SVY_Responses r INNER JOIN tbl_CRM_ParticipantSurveyCodes psc ON psc.responseID = r.responseID AND psc.ownerID = r.ownerID AND psc.ownerType = r.ownerType AND psc.approvalStatus = 'A' INNER JOIN tbl_CRM_Participants p ON p.participantID = psc.participantID AND p.ownerID = psc.ownerID AND p.ownerType = psc.ownerType INNER JOIN tbl_OPR_ClientOperators opr ON opr.operatorId = p.operatorId AND opr.ownerId = p.ownerID AND opr.fsltablecode = p.ownerType AND opr.territoryId in () INNER JOIN tbl_SVY_SurveyQuestions sq ON sq.surveyID = r.surveyID AND sq.ownerID = r.ownerID AND sq.ownerType = r.ownerType WHERE EXISTS ( SELECT * FROM tbl_SVY_Answers a INNER JOIN tbl_SVY_Choices c ON c.choiceID = a.choiceID AND c.ownerID = a.ownerID AND c.ownerType = a.ownerType WHERE a.responseID = r.responseID AND c.questionID = sq.questionID ) AND p.marketingActivityID = AND p.ownerID = AND p.ownerType = AND sq.questionID =
#questionPrompt#
Responses#qmd_questionResponseCount.questionResponseCount# of #qmd_sampleData.responseCount#/#qmd_sampleData.participantCount#
Required#qmd_surveyQuestions.answerRequired#
Multiple Choice#iif( qmd_surveyQuestions.maxSelections eq 1, de("N"), de( "Y" ))#
Activated#LSDateFormat( qmd_surveyQuestions.dateAdded, "MM-DD-YYYY")#
Deactiveated#IIF( qmd_surveyQuestions.deactivatedFlag eq "N", de(""), LSDateFormat( qmd_surveyQuestions.deactivatedDate, "MM-DD-YYYY"))#