sql server 2008 - SQL Conditional Statement in Where Clause -


i write following if statement in sql. of clause constructed, it's condition around statement i'm struggling with:

if @stuyear = 11  , (@teachinggroup = 'select all') , ([datacollection] = @datacollection) , ([name] = @subjectname)  , (@subgroup='select all')  , '' = case @subjectname when 'english' ks2en when 'mathematics' ks2ma else ks2av end  , result not '[abu]%' , result <> ''  else if @stuyear = 10   , @teachinggroup not 'select all'  , ([datacollection] = @datacollection)  , ([name] = @subjectname)  , ([teachinggroup] = @teachinggroup)   , @subgroup='select all'  , '' = case @subjectname when 'english' ks2en when 'mathematics' ks2ma else ks2av end  , result not '[abc]%' , result <> ''  end if 

simply replace if where , else if or , surround other conditions in paranthesis:

... (@stuyear = 11  , (@teachinggroup = 'select all') , ([datacollection] = @datacollection) , ([name] = @subjectname)  , (@subgroup='select all')  , '' = case @subjectname when 'english' ks2en when 'mathematics' ks2ma else ks2av end  , result not  'a*'  , result not 'a'  , result not 'b'  , result not 'u'  , result not '' )  or (@stuyear = 10  , @teachinggroup not 'select all'  , ([datacollection] = @datacollection)  , ([name] = @subjectname)  , ([teachinggroup] = @teachinggroup)   , @subgroup='select all'  , '' = case @subjectname when 'english' ks2en when 'mathematics' ks2ma else ks2av end  , result  not  'a*'  , result  not  'a'  , result not 'b'  , result  not  'c'  , result  not '') 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -