【发布时间】:2019-07-03 14:14:03
【问题描述】:
这是我下面的 WooCommerce SQL 查询。我不断收到错误,
Unknown column 'posts.ID' is 'on clause'
但我的 posts.ID 列确实存在。
SELECT DISTINCT posts.ID as product_id, posts.post_parent as parent_id FROM wp_posts posts,
wp_terms terms, wp_term_relationships term_relationships LEFT JOIN wp_wc_product_meta_lookup
wc_product_meta_lookup ON posts.ID=wc_product_meta_lookup.product_id WHERE
posts.ID=term_relationships.object_id AND term_relationships.term_taxonomy_id=terms.term_id
AND terms.name!='exclude-from-catalog' AND posts.post_type IN ('product')
AND ( ( ( posts.post_title LIKE '%bruno%') OR ( posts.post_excerpt LIKE '%bruno%')
OR ( posts.post_content LIKE '%bruno%' ) OR ( wc_product_meta_lookup.sku LIKE '%bruno%' ) ))
AND posts.post_status IN ('publish') ORDER BY posts.post_parent ASC, posts.post_title ASC;
【问题讨论】:
标签: mysql sql wordpress woocommerce