Question : SQL 'WHERE' Statement

Hi all,

I am creating a view in MS SQL Server 2005 and I seem to be struggling with the 'WHERE' statement. The statement I want to recreate is below - this is the statement that I would use in Crystal Reports but I need this to be converted to SQL because this particular query needs to be in a view in the database.

Can any help with this one please?

Tom
1:
2:
3:
if {Export.UserSchoolType} = "Infant" then {Export.PupilYearGroup} in [1 to 2]
else if {Export.UserSchoolType} = "Junior" then {Export.PupilYearGroup} in [3 to 6]
else if {Export.UserSchoolType} = "Primary" then {Export.PupilYearGroup} in [1 to 6]

Answer : SQL 'WHERE' Statement

this should do:
1:
2:
3:
WHERE ( Export.UserSchoolType = "Infant" AND Export.PupilYearGroup between 1 AND 2 )
   OR ( Export.UserSchoolType = "Junior" AND Export.PupilYearGroup between 3 AND 6 )
   OR ( Export.UserSchoolType = "Primary" AND Export.PupilYearGroup between 1 AND 6 )
Random Solutions  
 
programming4us programming4us