I would like to write the following IF statement in SQL. Most of the where clause is constructed, but it's the condition around the statement that I'm struggling with:
if @StuYear = 11 then
AND (@TeachingGroup = 'Select All')
AND ([DataCollection] = @DataCollection)
AND ([Name] = @SubjectName)
AND (@Subgroup='Select All')
AND '' = CASE @subjectName WHEN 'English' THEN KS2en WHEN 'Mathematics' THEN KS2ma ELSE KS2av END
AND Result Not Like '[ABU]%' AND Result <> ''
else if @StuYear = 10 then
AND @TeachingGroup Not Like 'Select All'
AND ([DataCollection] = @DataCollection)
AND ([Name] = @SubjectName)
AND ([TeachingGroup] = @TeachingGroup)
AND @Subgroup='Select All'
AND '' = CASE @subjectName WHEN 'English' THEN KS2en WHEN 'Mathematics' THEN KS2ma ELSE KS2av END
AND Result Not Like '[ABC]%' AND Result <> ''
end if