[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: Re: how to match all words
From: fenlon <fenlon () umd ! edu>
Date: 2007-03-28 3:02:04
Message-ID: 9705200.post () talk ! nabble ! com
[Download RAW message or body]
Pat,
I am by no means great with sql, but i think i may be able to help you. You
just need to load up your query with or statements. As i understand your
question, you will be searching name for several keywords (x1,x2,...) and
address for several keywrods (y1,y2...)
SELECT * FROM clients
WHERE
name LIKE '%x1%'
OR
name LIKE '%x2%'
AND
address LIKE '%y1%'
OR
address LIKE '%y2%'
This should return all records with names similar to x1 or x2 with address
similar to y1 or y2.
Patrick Aljord wrote:
>
> Hey all,
> I have a table 'clients' like this:
> id int(5),
> name varchar(55),
> address varchar(55)
>
> I would like to select all the records that have '%x%' and '%y%' but
> '%x%' can be in name and '%y%' can be in address. Also in my query
> there are generally more words to match (x,y,z,t etc) and I can't use
> full text search. Any what's the best way to do this?
>
> Thanx in advance
>
> Pat
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=lists@nabble.com
>
>
>
--
View this message in context: http://www.nabble.com/how-to-match-all-words-tf3412448.html#a9705200
Sent from the MySQL - General mailing list archive at Nabble.com.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic