• Forum
  • Lounge
  • Cannot figure out the issue with this SQ

 
Cannot figure out the issue with this SQL CASE

CASE
WHEN CAST(a.category AS VARCHAR) like '%jumpsuits%' THEN CAST(a.google_product_category AS VARCHAR) = 'Apparel & Accessories > Clothing > One-Pieces > Jumpsuits & Rompers'
WHEN CAST(a.category AS VARCHAR) like '%knitwear%' THEN CAST(a.google_product_category AS VARCHAR) = 'Apparel & Accessories > Clothing > Dresses'
WHEN CAST(a.category AS VARCHAR) like '%lounge wear%' THEN CAST(a.google_product_category AS VARCHAR) = 'Apparel & Accessories > Clothing > Shirts & Tops'
ELSE CAST(a.google_product_category AS VARCHAR) END as google_product_category
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

sql
I see 3 bools and a string on the else.
that matches the complaint.
Topic archived. No new replies allowed.