I am trying to do a case expression with mixed data types with no avail. Please could I get some help with what I'm doing wrong, please see my statement below
Case
when c.student_age > 19
and c.count_forms > 3
and ss.value :: date <@ fiscal_year.f_year
then "Y"
else "N"
end as student_r_year
I'm using both int and date data in the first part of the case statement and that's where the issue is.
THEN
and theELSE
- not those used to evaluate the expression. What is the error you get? Do you really have a column named"Y"
- or do you want to return a string constant?'Y'
is a string constant,"Y"
is an identifier. – a_horse_with_no_name May 2 '19 at 10:24ss.value::date < fiscal_year.f_year
? What data type isss.value
. And as I have already mentioned"Y"
is not a string constant. Those need single quotes, e.g.'Y'
– a_horse_with_no_name May 2 '19 at 10:58