My query was running fine, but after a adding a case statement I received an error on some of the column.
QUERY before the case statement:
select date_, S