Skip to content
Advertisement

Cannot figure out the issue with this SQL CASE

The issue i am facing is: “SYNTAX_ERROR: line 7:6: All CASE results must be the same type: boolean”

I have also joined the table in a previous sub query casting it as a varchar, so there shouldn’t be any issues with this.

Anyone have any ideas?

For context i am trying to populate a field that would return a blank where the category is like my “likes” anything else i just want it to remain as it is.

Many thanks

Advertisement

Answer

Your CASE has expressions returning different data types, which is not allowed. If you’re simply trying to update the google_product_category based on the category column, try something like this:

Data sample

Query

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement