gpt4 book ai didi

mysql - “in” 语句中的多个列 (mysql)

转载 作者:行者123 更新时间:2023-11-29 05:10:06 24 4
gpt4 key购买 nike

你能告诉我如何实现这个sql查询吗:

select * from products where (category, category2, category3) in (2, 138, 136, 125)

错误:

#1241 - Operand should contain 3 column(s)

最佳答案

只需像这样在 where 子句中写入所有列:

SELECT *
FROM products
WHERE
category IN (2, 138, 136, 125) OR
category2 IN (2, 138, 136, 125) OR
category3 IN (2, 138, 136, 125)

关于mysql - “in” 语句中的多个列 (mysql),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40889351/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com