0

I'm trying to include an "OR" clause in a CASE but I keep getting

"Error Code: 1241. Operand should contain 1 column(s)

Here's a sample of the query.

       select [...],
            CASE  
                when category1.Category1Name in (...) or category1.Category1Name like (...) then 'L-ACCESSORIES'
                when[...]
            end as 'Style'
       from [...]

If someone could shed some like on this it'd be much appreciated.

2 Answers2

0

this syntax completely worked on mysql

SELECT OrderID, Quantity,
CASE
    WHEN Quantity like 3 or quantity like 100 THEN "The quantity is either 3 or 100"

    ELSE "The quantity is something else"
END
FROM OrderDetails;

but when i used in instead of like it didn't work so the issue is not with or it's with ==> in . each case must be closed as well

parsa
  • 987
  • 2
  • 10
  • 23
0

The issue is most likely coming from your like statement. It can only contain 1 value. If you write

like(1,2) 

you will get this error.

All other operations should work in mysql.

isaace
  • 3,336
  • 1
  • 9
  • 22