A column in this calculation does not exist when it does

Hello guys, 

 

I am trying to get a calculated field with case when. However, the calculation keeps saying that a column does not exist (when it obviously does)

 

Do you guys know what might have caused this problems? Thank you!

Best Answer

  • Figauro
    Figauro 🟡
    Accepted Answer

    Hello,

     

    Try and change to this:

    case when `travel_type` = 'DOMESTIC' or `travel_type` = 'OTHER DOMESTIC' then 'Domestic' else 'International' end

     

    You need to use apostrophes instead of quotations. Another way to do this case would be this:

    case when instr(`travel_type`,'domestic') > 0 then 'domestic' else 'international' end

     

     

Answers