I hope you can help. I want to do a keyword search on products including multiple tables. But not every product has any entries in each table...
Example
table 'product'
id product_name description
1 my product this is my favorite product
2 another item that is another product
3 blue car for driving away
table 'keywords'
prod_id keywords
2 car, product, blue
So, now I want to get all products, having 'car' in its 'product_name', 'description' or 'keywords'
Just using a simple mysql query will only have those products as result, which are in both tables:
SELECT A.id FROM product A, keywords B WHERE A.ID = B.product_id AND....
I tried LEFT JOIN - but that had all three products as result (maybe I did it wrong):
SELECT A.id FROM product A LEFT JOIN keywords B ON A.id = B.prod_id AND (A.product_name LIKE '%car%' OR A.description LIKE '%car%' OR B.keywords LIKE '%car%')
Can anyone help? Thanks & regards Jan