Hey!
I also would like to add something: CAST(... AS DATE) is not working only CAST(... AS date), shouldn't it be case-insensitive?