MySQL LIKE IN()?

MySQL LIKE IN()?(MySQL LIKE IN()?)

本文介绍了MySQL LIKE IN()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的查询如下所示:

My current query looks like this:

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-社区日志

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 LIKE IN()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:MySQL LIKE IN()?

基础教程推荐