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.
I agree. But I think the English phrasing should be: "The condition should not use either the IN or the
OR operators." Or, alternatively, "The condition should use neither
the IN nor the
"The condition should not use either the IN and OR operators" correctly follows the computer logic needed (for example, something like condition_used <> 'IN' AND condition_used <> 'OR'
). But in English "or" (or "nor") is used for this purpose.
Or maybe I'm using "or" too much. :-)
"I love spending twice as long and working twice as hard to get half as much done!" – Nobody ever.
"Operator! Give me the number for 911!" - Homer Simpson
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'"