469,579 Members | 1,899 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

Need help on simple pattern matching searching

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
1 2509

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.

Similar topics

176 posts views Thread by Thomas Reichelt | last post: by
2 posts views Thread by MrNobody | last post: by
2 posts views Thread by phaeton123 | last post: by
2 posts views Thread by Ole Nielsby | last post: by
1 post views Thread by VanKha | last post: by
9 posts views Thread by Chris | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.