Error in query

  
Hello People,

Can you please help me to identify what is wrong with this query?

SELECT {SurveyForm}.[Title],
CASE 
WHEN MONTH(GETDATE()) <=3 THEN MONTH({SurveyForm}.[DueDate]) IN(10,11)
ELSE NULL END AS DueDate

FROM {SurveyForm}

Thanks

well, the IN-part is a bit strange there
Hi J,

I want the matching records which can be compared using either IN operator or between operator but both are not working
Try using "IN" in a where clause

something like this : 
SELECT {SurveyForm}.[Title],
CASE 
WHEN MONTH(GETDATE()) <=3 THEN (SELECT MONTH ({SurveyForm}.[DueDate]) FROM {SurveyForm} where MONTH ({SurveyForm}.[DueDate]) IN (10,11) ) 
ELSE NULL END AS DueDate

FROM {SurveyForm}
 
I have no clue what you actually want to achieve.


I want to select records from last quarter.
Suraj, 

Have you looked at the DATEPART function?

Cheers!
Hi everybody,

Thanks for your help.

I am able to get previous quarters record.

I changed my query to

SELECT {SurveyForm}.[Title],''

FROM {SurveyForm}
where ({SurveyForm}.[DueDate] between DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) - 1, 0) AND 
        DATEADD(dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()), 0))) 

Thanks again.