At 09:32 PM 3/15/2007, you 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

Pat,
        If your table is small (a couple thousand rows), then you could try:

select * from clients where
(name like '%word1%' or address like '%word1%') and
(name like '%word2%' or address like '%word2%') and
....
(name like '%word10%' or address like '%word10%')


This is quite slow and clumsy to implement. . Why can't you use full text search? It is your best solution.

Mike
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to