For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > April 2004 > pattern matching in mysql









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author pattern matching in mysql
abracad

2004-04-17, 4:31 pm

I have a table, location, of place names eg

place
-----
London
Hong Kong
New York

and wish to search for any places in a user-entered search string eg
"London Hong Kong"

In Access the query
SELECT * FROM location
WHERE 'London Hong Kong' LIKE '*'&place&'*'
returns both Hong Kong and London

But in MySQL nothing is returned, even replacing the MS-specific *
with %

How is this achieved in MySQL?

Thanks
Joachim Mæland

2004-04-18, 6:31 am

On Sat, 17 Apr 2004 12:35:13 -0700, abracad wrote:

> I have a table, location, of place names eg
>
> place
> -----
> London
> Hong Kong
> New York
>
> and wish to search for any places in a user-entered search string eg
> "London Hong Kong"
>
> In Access the query
> SELECT * FROM location
> WHERE 'London Hong Kong' LIKE '*'&place&'*'
> returns both Hong Kong and London
>
> But in MySQL nothing is returned, even replacing the MS-specific *
> with %
>
> How is this achieved in MySQL?


fulltext

--
mvh/regards
Joachim Mæland

If everything seems under control, you're just not going fast enough.
-Mario Andretti

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com