How about using a fulltext index on the field then using a LIKE wild 
card limiting.

Example:

SELECT blah FROM tbl WHERE MATCH (ftindex_col) AGAINST ('Neil Young')
AND col LIKE "Neil Young%";

This will find only items with Neil or Young AND ^Neil Young, Playing 
around with this formula will allow you to control what type of 
results you receive.



Stephen Griffiths wrote:
> 
> Hi people,
> 
> I think this is a tough question, or it could be pretty easy. I have
> this text file which has a line that has 'someartist - some song'. I use
> php to open the file and read the line and I now pass this line into the
> mysql query. (lets use $string as the var). Here's the problem.
> 
> I have an Artist field that has a few entries like 'Artist a', 'artist
> b', 'foobar asrtist' blah blah. What I want to is the mysql to search
> through the artist field to find the closest match to $string. For
> example, if my Artist field contained 'Neil Young' and $string contained
> 'Neil Young - Let's Roll', it would have 'Neil Young' as the closest
> match in it's result set.
> 
> E-mail me if you need more info or don't get what I'm asking. Hopefully
> you people can help me. :)  If isn't "SELECT * from Artist_tbl WHERE
> Artist LIKE '%$string%"; either  ;)   Hope someone can understand my
> gibberish and help me out :)
> 
> Thanxs
> 
> --
> 
> Steve Griff
> 
> 
> mailto: [EMAIL PROTECTED]    |  http://www.stevegriff.com
> 
> Live CDR Trading: Beck, Neil Young, Frank Zappa, Radiohead, Ry Cooder,
>                   Bowie, Xtc, Nirvana & More.
>                                 E-Mail me for any music trade!
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-- 
Colin Faber
(303) 859-1491
fpsn.net, Inc.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to