I am trying to search against multiple mySQL tables, Can any one point me to where I am wrong ?
Below is my query, and my DB structure.
PHP Code:
SELECT categories.name AS category, categories.id AS category_id, host_types.name AS host_type, host_types.id AS host_type_id, hosts.name AS host, hosts.id AS host_id, products.name as name, products.id AS product_id, products.keywords as keywords, products.description AS description, products.quantity AS quantity, products.price AS price, products.uid as catalgue MATCH(categories.name) AGAINST('search term') as cscore, MATCH(host_types.name) AGAINST('search term') as htscore, MATCH(hosts.name) AGAINST('search term') as hscore, MATCH(products.name, products.keywords, products.description, products.uid) AGAINST('search term') as score FROM products LEFT JOIN hosts ON products.host_id = hosts.id LEFT JOIN host_types ON hosts.host_id = host_types.id LEFT JOIN categories ON host_types.category_id = categories.id WHERE MATCH(categories.name) AGAINST('search term') OR MATCH(host_types.name) AGAINST('search term') OR MATCH(hosts.name) AGAINST('search term') OR MATCH(products.name, products.keywords, products.description, products.uid) AGAINST('search term') ORDER BY score DESC
Bookmarks