When i run the following query on its own and give the @Tutor parameter value All it seems to work.
SELECT VIEW_TUTOR.TUTOR_ID, VIEW_TUTOR.NAME, COURSES.DELIVERYTYPE, COURSES.SYLLABUS, QUESTION_RESULTS.RESPONSE, COURSES.DATE,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 1 THEN 1 ELSE 0 END) AS [1s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 2 THEN 1 ELSE 0 END) AS [2s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 3 THEN 1 ELSE 0 END) AS [3s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 4 THEN 1 ELSE 0 END) AS [4s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 5 THEN 1 ELSE 0 END) AS [5s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 1 THEN 1 ELSE 0 END) AS v1s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 2 THEN 2 * 1 ELSE 0 END) AS v2s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 3 THEN 3 * 1 ELSE 0 END) AS v3s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 4 THEN 4 * 1 ELSE 0 END) AS v4s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 5 THEN 5 * 1 ELSE 0 END) AS v5s
FROM QUESTION_RESULTS INNER JOIN
COURSES ON QUESTION_RESULTS.SESSION = COURSES.SESSION INNER JOIN
VIEW_TUTOR ON QUESTION_RESULTS.TUTOR_ID = VIEW_TUTOR.TUTOR_ID
WHERE (NOT (QUESTION_RESULTS.RESPONSE IS NULL)) AND (VIEW_TUTOR.NAME IN (@Tutor)) OR
(NOT (QUESTION_RESULTS.RESPONSE IS NULL)) AND (@Tutor = 'All')
But when I incorporate this with the report the I get a blank result when I pass the All value. The following query is used in the report.
Help would be very much appreciated
Var Sql 2005 Reporting services
SELECT VIEW_TUTOR.TUTOR_ID, VIEW_TUTOR.NAME, COURSES.DELIVERYTYPE, COURSES.SYLLABUS, QUESTION_RESULTS.RESPONSE, COURSES.DATE,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 1 THEN 1 ELSE 0 END) AS [1s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 2 THEN 1 ELSE 0 END) AS [2s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 3 THEN 1 ELSE 0 END) AS [3s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 4 THEN 1 ELSE 0 END) AS [4s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 5 THEN 1 ELSE 0 END) AS [5s],
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 1 THEN 1 ELSE 0 END) AS v1s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 2 THEN 2 * 1 ELSE 0 END) AS v2s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 3 THEN 3 * 1 ELSE 0 END) AS v3s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 4 THEN 4 * 1 ELSE 0 END) AS v4s,
(CASE WHEN dbo.QUESTION_RESULTS.RESPONSE = 5 THEN 5 * 1 ELSE 0 END) AS v5s
FROM QUESTION_RESULTS INNER JOIN
COURSES ON QUESTION_RESULTS.SESSION = COURSES.SESSION INNER JOIN
VIEW_TUTOR ON QUESTION_RESULTS.TUTOR_ID = VIEW_TUTOR.TUTOR_ID
WHERE (NOT (QUESTION_RESULTS.RESPONSE IS NULL)) AND (COURSES.DATE BETWEEN @startdate AND @enddate) AND (VIEW_TUTOR.NAME IN (@Tutor))
OR (NOT (QUESTION_RESULTS.RESPONSE IS NULL)) AND (@Tutor = 'All')