[英]Trying to include an “or” in a case on mysql - Error Code: 1241. Operand should contain 1 column(s)
I'm trying to include an "OR" clause in a CASE but I keep getting 我试图在CASE中包含“ OR”子句,但我不断
"Error Code: 1241. Operand should contain 1 column(s)
“错误代码:1241。操作数应包含1列
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. 如果有人能像这样洒下它,将不胜感激。
this syntax completely worked on mysql 这种语法完全适用于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 . 但是当我使用in而不是像它那样无法正常工作时,所以问题不在或与==> in。 each case must be closed as well
每个案例也必须关闭
The issue is most likely coming from your like
statement. 该问题很可能来自您的
like
声明。 It can only contain 1 value. 它只能包含1个值。 If you write
如果你写
like(1,2)
you will get this error. 您将收到此错误。
All other operations should work in mysql
. 所有其他操作应在
mysql
工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.