简体   繁体   中英

Match Against Left Outer Join

SELECT p.product_id,p.account_id,i.image_id,a.email,p.title,p.price
FROM products AS p
LEFT OUTER JOIN products_images AS i
ON p.product_id = i.product_id AND i.featured=1 AND i.deleted=0
INNER JOIN accounts AS a
ON p.account_id = a.account_id
MATCH(p.title) AGAINST('+images')

I'm trying to use a MATCH for the first time. It says that I have a syntax error and I am not sure why?

You're missing the WHERE keyword before conditions that aren't part of the join:

SELECT p.product_id,p.account_id,i.image_id,a.email,p.title,p.price
FROM products AS p
LEFT OUTER JOIN products_images AS i
ON p.product_id = i.product_id AND i.featured=1 AND i.deleted=0
INNER JOIN accounts AS a
ON p.account_id = a.account_id
WHERE MATCH(p.title) AGAINST('+images')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM