Let us say I have two tables tab1 and tab2. 

tab1: 
   col1
   col2

tab2:
   col3
   col4

For my search, a user can enter space delimited words to search, e.g.,

   microsoft windows xp

i have to search for EACH of these words, and join the 2 tables too, so
my sql query looks somewhat like this: 

select * from tab1, tab2 
where
tab1.col1 = tab2.col3 
and  
(
     tab1.col1  = "microsoft" 
  or tab1.col2  = "microsoft" 
  or tab1.col1  = "windows" 
  or tab1.col2  = "windows" 
  or tab1.col1  = "xp"
  or tab1.col2  = "xp"
)
;


now my question is how can i optimize this query? apart from the sql, can
i set some indices which will help me make this faster? 

thanks/erick

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

---------------------------------------------------------------------
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