MySQL Forums
Forum List  »  Knowledge Base

Searching Two Tables
Posted by: Simon Emms
Date: February 16, 2009 05:59PM

I've created a search facility on my site and it works lovely. What it does is search products and then searches suppliers.

Does anyone know of a way of combining these two queries into one query?

Search 1

SELECT *, MATCH (description) AGAINST ('%$search%' in boolean mode), MATCH (description) AGAINST ('%$search%' in boolean mode) SCORE FROM products WHERE ($searchproduct) OR ($searchdescription) ORDER BY SCORE DESC

Search 2

SELECT *, MATCH (rawname) AGAINST ('%$search%' in boolean mode) SCORE FROM suppliers WHERE ($searchsuppliers) AND CHAR_LENGTH(imageext) > 0 ORDER BY SCORE ASC

Thanks

Simon

============================
http://www.real-ale-shop.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Searching Two Tables
3439
February 16, 2009 05:59PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.