I've attempted to make this question as simple as possible. Listed below is my sql:
SELECT DISTINCT
fr.EmployeeID
,dsg.SourceKey
FROM Final.FactRegistration fr
join Final.FactStudentGroups fsg
on fr.EmployeeID = fsg.EmployeeID
and fr.TermKey = fsg.TermKey
and fr.VersionKey = fsg.VersionKey
join Final.DimStudentGroup dsg
on fsg.StudentGroupSourceKey = dsg.SourceKey
and dsg.SourceKey = @StudentGroupKey
WHERE 1=1
AND fr.VersionKey = 1
and fr.EmployeeID
The development of this query will lead me to create a stored procedure. The stored procedure will then be used to populate a SSRS report. Here's the main point to my question. How can the query be written, to allow for an SSRS report to run by not filtering by the student group? However, once the report is run, I still would like to have the ability to filter by student group.
Sample Output Below:
Initial run (All parameters Passed)
EmployeeID | StudentGroup
XXXXXXXXX | ATHLETE
YYYYYYYYY | Null
OOOOOOOO | FinishInFour
ZZZZZZZZ | Null
PPPPPPPP | Honor
LLLLLLLL | Honor
WWWWWWWW | ATHLETE
Now assume I want to only view Honor students, my output would be:
EmployeeID | StudentGroup
PPPPPPPP | Honor
LLLLLLLL | Honor
I need to create a query, stored procedure that will allow for the above output to be accomplished.
Feedback is appreciated, feel free to let me know if you need more information.