CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   MySQL (http://www.codingforums.com/forumdisplay.php?f=7)
-   -   MYSQL LIKE and more than one beginning letter (http://www.codingforums.com/showthread.php?t=286507)

mikemacx 01-27-2013 02:25 AM

MYSQL LIKE and more than one beginning letter
 
Hi all......

Can't seem to find the answer anywhere, so I thought you might know. When using LIKE, how do I search for records where the column values begin with MULTIPLE letters, such as A, R, and T.

I know in SQL it's SELECT * from products_tbl WHERE prod_desc LIKE '[cpa]%'

But I don't know how to do this in MYSQL....the above query returns an empty set when I know the letters are there.

Thanks!

zergi 01-27-2013 04:11 PM

It's REGEXP what you are looking for: ... WHERE prod_desc REGEXP '^[cpa]'

mikemacx 01-27-2013 08:12 PM

That was it!......Appreciated and thanked!


All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.