Since the question clearly states:
The condition should not use both IN and OR operators.
use could use:
where DatePart(m, ) IN (1,3,4,5,7,8)
OR is not used, so since they BOTH aren't used, this is valid.
you also could use:
where DatePart(m, date) = 1
or DatePart(m, date) = 3 ....
as long as you don't use IN, this also would satisify the requirement not to use both.
The question should have stated
The condition should not use either the IN and OR operators.
Yes, I know what was meant. But the requirements didn't adequately specify the intention.
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT
on a production system! After all, you
will be the one supporting it!
Links: For better assistance in answering your questions
, How to ask a question
, Performance Problems
, Common date/time routines
,CROSS-TABS and PIVOT tables Part 1
& Part 2
, Using APPLY Part 1
& Part 2
, Splitting Delimited Strings