Although is does not always work but, some times ad-hoc thinking makes the solution very simple. Consider the following scenario for which a very simplified solution is provided for. We may call it out of box thinking as well.
Is there a condition for the WHERE clause to display the details about the students born in the month numbers of 1[Jan], 3,4,5,7,8? The condition should not use both IN and OR operators.
Explanation: We can give the condition as follows:
where datename(m,dob) not like ‘%e%’
because these month(s) specified do not have the letter ‘e’, but all the other months have at least one ‘e’ in month name.
Note: The question of day is taken from SqlServerCentral.com. I want to compile selected QOD to share.