MySQL Forums
Forum List  »  Newbie

Re: help in select ... where ...like...
Posted by: Rick James
Date: July 18, 2009 02:51PM

Or use the word boundary regexp found in
http://dev.mysql.com/doc/refman/5.1/en/regexp.html
mysql> select vc from misc where vc rlike '[[:<:]]4[[:>:]]';
+--------+
| vc     |
+--------+
| 4,2,33 |
+--------+
1 row in set (0.00 sec)

mysql> select vc from misc where vc rlike '[[:<:]]3[[:>:]]';
Empty set (0.00 sec)

mysql> select vc from misc where vc rlike '[[:<:]]2[[:>:]]';
+--------+
| vc     |
+--------+
| 1,2,11 |
| 4,2,33 |
+--------+
2 rows in set (0.00 sec)

mysql> select vc from misc where vc rlike '[[:<:]]1[[:>:]]';
+--------+
| vc     |
+--------+
| 1,2,11 |
+--------+
1 row in set (0.00 sec)

mysql> select vc from misc where vc rlike '[[:<:]]11[[:>:]]';
+--------+
| vc     |
+--------+
| 1,2,11 |
+--------+
1 row in set (0.00 sec)

Options: ReplyQuote


Subject
Written By
Posted
Re: help in select ... where ...like...
July 18, 2009 02:51PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.