Subject Re: How can I correctly write this WHERE
Author
From what I can see, if your clause is failing on the date comparison, it could be that you are comparing a date object to a string.  You should ensure that your castings are correct for both sides of the comparison clause.

After looking at the CASE clause you provided, its structure appears to be correct...