MySQL喜欢IN()吗? [英] MySQL LIKE IN()?
本文介绍了MySQL喜欢IN()吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我当前的查询如下:
SELECT * FROM fiberbox f WHERE f.fiberBox LIKE '%1740 %' OR f.fiberBox LIKE '%1938 %' OR f.fiberBox LIKE '%1940 %'
我环顾四周,找不到类似于LIKE IN()的东西-我认为它的工作方式如下:
I did some looking around and can't find anything similar to a LIKE IN() - I envision it working like this:
SELECT * FROM fiberbox f WHERE f.fiberbox LIKE IN('%140 %', '%1938 %', '%1940 %')
有什么想法吗?我只是以错误的方式思考问题-一些我从未见过的晦涩命令.
Any ideas? Am I just thinking of the problem the wrong way - some obscure command I've never seen.
MySQL 5.0.77-community-log
MySQL 5.0.77-community-log
推荐答案
A REGEXP 可能效率更高,但是您必须对其进行基准测试以确保,例如
A REGEXP might be more efficient, but you'd have to benchmark it to be sure, e.g.
SELECT * from fiberbox where field REGEXP '1740|1938|1940';
这篇关于MySQL喜欢IN()吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文