List:General Discussion« Previous MessageNext Message »
From:thomas Armstrong Date:September 20 2007 7:59am
Subject:Re: Query to find "foo" within "(foo)"
View as plain text  
> If you need something more complicated, such as only ignoring "(", then you
> need to get more complicated. You might even need a regular expression.
I'm to browse:
http://dev.mysql.com/doc/refman/5.0/en/regexp.html
http://www.wellho.net/regex/mysql.html

Thank you very much!


>
> Regards,
>
> Jerry Schwartz
> The Infoshop by Global Information Incorporated
> 195 Farmington Ave.
> Farmington, CT 06032
>
> 860.674.8796 / FAX: 860.674.8341
>
> www.the-infoshop.com
> www.giiexpress.com
> www.etudes-marche.com
>
>
> > -----Original Message-----
> > From: thomas Armstrong [mailto:tarmstrong@stripped]
> > Sent: Wednesday, September 19, 2007 1:35 PM
> > To: mysql@stripped
> > Subject: Query to find "foo" within "(foo)"
> >
> >  Hi.
> >
> > I've got this table in mySQL:
> >
> > item 1:
> > -- firstname: John (Johnie)
> > -- phone: 555-600-200
> >
> > item 2:
> > -- firstname: Peter
> > -- phone: 555-300-400
> >
> > I created this SQL query to find 'johnie':
> > ------------------------
> > SELECT friends.id FROM friends WHERE ((friends.firstname LIKE '%
> > johnie %' OR friends.firstname LIKE 'johnie %' OR friends.firstname
> > LIKE '% johnie' OR friends.firstname LIKE 'johnie' OR friends.phone
> > LIKE '% johnie %' OR friends.phone LIKE 'johnie %' OR friends.phone
> > LIKE '% johnie' OR friends.phone LIKE 'johnie')) ORDER BY
> > friends.firstname LIMIT 0, 9999
> > ------------------------
> >
> > But it doesn't match anything, because it's considers "(johnie)" as a
> > single word. Is there any way to make mySQL consider "(johnie)" as
> > "johnie".
> >
> > I know I can create another condition within my query:
> > firstname LIKE '(johnie)' OR firstname LIKE '(johnie%' OR firstname
> > LIKE '%johnie)'
> > but I also might consider other characters like ' " - *
> >
> > Any suggestion?
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:
> > http://lists.mysql.com/mysql?unsub=1
> >
> >
>
>
>
>
Thread
Query to find "foo" within "(foo)"thomas Armstrong19 Sep
  • Re: Query to find "foo" within "(foo)"Chris Sansom19 Sep
  • RE: Query to find "foo" within "(foo)"Jerry Schwartz19 Sep
    • Re: Query to find "foo" within "(foo)"thomas Armstrong20 Sep
      • Re: Query to find "foo" within "(foo)"Baron Schwartz20 Sep
        • Re: Query to find "foo" within "(foo)"thomas Armstrong21 Sep
Re: Query to find "foo" within "(foo)"thomas Armstrong20 Sep
  • RE: Query to find "foo" within "(foo)"Jerry Schwartz20 Sep
Re: Query to find "foo" within "(foo)"thomas Armstrong20 Sep