By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,070 Members | 1,718 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,070 IT Pros & Developers. It's quick & easy.

Need help on simple pattern matching searching

P: n/a
I have a table that stores a list of zip codes using a varchar column type,
and I need to perform some string prefix pattern matching search. Let's say
that I have the columns:
94000-1235
94001
94100

If I run a pattern matching search for the string "940", then I should get
the top two rows of data back. If I run a pattern matching search for the
string "94", then I should get all the three rows of data back.
How can I do that in MySQL? I dont' need to do full-text search for this
prefix pattern matching search, do I? Thanks.
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

SELECT * FROM database WHERE col LIKE '940%'

"Henry" <hj***************@yahoo.com> wrote in message
news:eY*******************@newssvr21.news.prodigy. com...
:I have a table that stores a list of zip codes using a varchar column type,
: and I need to perform some string prefix pattern matching search. Let's
say
: that I have the columns:
: 94000-1235
: 94001
: 94100
:
: If I run a pattern matching search for the string "940", then I should get
: the top two rows of data back. If I run a pattern matching search for the
: string "94", then I should get all the three rows of data back.
: How can I do that in MySQL? I dont' need to do full-text search for this
: prefix pattern matching search, do I? Thanks.
:
:
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.