我是sql中的新手......这个查询似乎与内部联接运行完全正常,然后为什么作者仍然选择了左连接?
SELECT *
FROM {$wpdb->posts} notices
LEFT JOIN {$wpdb->postmeta} instances
ON ( notices.ID = instances.post_id AND instances.meta_key = 'mycred_email_instance' )
LEFT JOIN {$wpdb->postmeta} pointtype
ON ( notices.ID = pointtype.post_id AND pointtype.meta_key = 'mycred_email_ctype' )
WHERE instances.meta_value = %s
AND pointtype.meta_value IN (%s,'all')
AND notices.post_type = 'mycred_email_notice'
AND notices.post_status = 'publish'
提前致谢!