我已经运行了这段代码:
SELECT * FROM wp_postmeta
INNER JOIN wp_term_relationships ON wp_postmeta.post_id = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = '10'
LEFT JOIN wp_posts ON wp_postmeta.post_id = wp_posts.id AND wp_postmeta.meta_value = 'US' AND wp_posts.post_date BETWEEN CONCAT(CURDATE(),' 10:00:00') AND CONCAT(CURDATE(),' 18:00:00')
WHERE wp_postmeta.meta_key = '_shipping_country' AND wp_postmeta.meta_value IN ('AU', 'US', 'JP', 'BR', 'UK')
ORDER BY wp_postmeta.post_id DESC
这只是选择它们等于wp_postmeta.meta_key
和的位置。wp_postmeta.meta_value
_shipping_country
AU
这些字段中有更多数据需要检索。
所以,我假设我在最后像这样重新加入它:
SELECT * FROM wp_postmeta
INNER JOIN wp_term_relationships ON wp_postmeta.post_id = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = '10'
LEFT JOIN wp_posts ON wp_postmeta.post_id = wp_posts.id AND wp_postmeta.meta_value = 'US' AND wp_posts.post_date BETWEEN CONCAT(CURDATE(),' 10:00:00') AND CONCAT(CURDATE(),' 18:00:00')
WHERE wp_postmeta.meta_key = '_shipping_country' AND wp_postmeta.meta_value IN ('AU', 'US', 'JP', 'BR', 'UK')
LEFT JOIN wp_postmeta ON wp_posts.id = wp_postmeta.post_id
ORDER BY wp_postmeta.post_id DESC
然而这失败了?