You are right. I am trying to joing all of the brands_id with products_id and search through PRODUCTS database for matches. Products is the table I want to search through, as if the linked BRANDS were part of it. So I could find that text as well.
The query I used works, but is slow.. 12 second searches now. No there are no indexes yet, I was waiting to see if I could create a more efficient query first.
Scott
vincent wrote:
Your query looks a bit strange...
select products.*,
brand_wt.brand_wt,
brand_lsc.brand_lsc
FROM products, brand_wt,
brand_lsc
WHERE
brand_lsc.brand_lsc LIKE '$search_text%'
AND products.brand_lsc_id=brand_lsc.brand_lsc_id
OR brand_wt.brand_wt LIKE '%$search_text%'
AND products.brand_wt=brand_wt.brand_wt_id
OR product_name LIKE '%$search_text%'
GROUP BY product_id";
are you trying to join products with brand_lsc on the id
and join products with brand_wt on the id
and then see if brands_lsc.brand_lsc contains search_text
AND
either brant_wt.brand_wt contains search_text
or product_name contains search_text?
or are you looking to do seperate joins for each of the LIKE statements?
Parenthesis might help you and your database work out what you are trying to do.
Are you using any indexes? they can speed your search up quite a bit.
Try running your query manually using the EXPLAIN command in SQL, that w....