Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2013, 02:25 AM   PM User | #1
mikemacx
New Coder

 
Join Date: Feb 2009
Location: Los Angeles
Posts: 40
Thanks: 2
Thanked 1 Time in 1 Post
mikemacx is an unknown quantity at this point
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!
mikemacx is offline   Reply With Quote
Old 01-27-2013, 04:11 PM   PM User | #2
zergi
New to the CF scene

 
Join Date: Nov 2012
Posts: 9
Thanks: 1
Thanked 2 Times in 2 Posts
zergi is an unknown quantity at this point
It's REGEXP what you are looking for: ... WHERE prod_desc REGEXP '^[cpa]'
zergi is offline   Reply With Quote
Users who have thanked zergi for this post:
mikemacx (01-27-2013)
Old 01-27-2013, 08:12 PM   PM User | #3
mikemacx
New Coder

 
Join Date: Feb 2009
Location: Los Angeles
Posts: 40
Thanks: 2
Thanked 1 Time in 1 Post
mikemacx is an unknown quantity at this point
That was it!......Appreciated and thanked!
mikemacx is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:52 PM.


Advertisement
Log in to turn off these ads.