如何在MySQL中搜索模式? [英] How to search a pattern in MySQL ?

查看:61
本文介绍了如何在MySQL中搜索模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各位大家好!


我在表格中有一列,其数据与此类空格分开 - >

AS DD QW-02-44 WE

FG QW-02-44 RE WE

QW WQ


我正在实施搜索功能其中用户将在文本框中输入一些数据进行搜索。

例如: - 如果用户想要 retreive WQ 的行然后结果应该是第3行


如何做到这一点?


平台 - > ; Debian Sarge

语言 - > Perl CGI

Hi all of you !!

I have a column in a table which has data seperated by spaces like this -->
AS DD QW-02-44 WE
FG QW-02-44 RE WE
QW WQ

I am implementing a search functionality wherein a user will enter some data in a textbox to search.
For eg:- if the user wants to retreive rows which have WQ in them then the result should be 3rd row above.

How to do this ?

Platform --> Debian Sarge
Language --> Perl CGI

推荐答案

有不同的方法,例如使用LIKE属性或正则表达式。以下示例显示了每种方法(我个人赞成正则表达式方法)。
There are different ways of doing this, such as using the LIKE attrib or a regular expression. The following samples show each method (I personnaly favor the regular expression method).
展开 | 选择 | Wrap | 行号



有不同的方法,例如使用LIKE attrib或正则表达式。以下示例显示了每种方法(我个人赞成正则表达式方法)。
There are different ways of doing this, such as using the LIKE attrib or a regular expression. The following samples show each method (I personnaly favor the regular expression method).
展开 | 选择 | Wrap | 行号


取决于您是否要测试一个字符串''WQ QW''或两个单独的字符串''WQ''和''QW''。
Depends on whether you want to test for one string ''WQ QW'' or for 2 separate strings ''WQ'' and ''QW''.
展开 | < span class =codeLinkonclick =selectAll(this);> Sel ect | Wrap | 行号


这篇关于如何在MySQL中搜索模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆