本文介绍了MySQL查询值列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从值列表中创建一个查询,并为每个cat
匹配项返回数据.
I want to create a query from a list of values and return data for every match of cat
.
这有效,但是不需要options
值.查询值列表的简便方法是什么?
This works but it's not requiring the options
value. What's the easier way to query a list of values?
SELECT *
FROM `table1`
WHERE `option`='R' && `cat`='12' || `cat`='18' || `cat`='30'
推荐答案
您可以使用IN
运算符
`cat` IN ('12', '18', 30')
这篇关于MySQL查询值列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!