SELECT b.post_title
, a.post_id
, Deriv1.Count
FROM wp_posts b
, wp_postmeta a
LEFT OUTER JOIN (
SELECT meta_value, COUNT( * ) AS Count
FROM wp_postmeta
GROUP BY meta_value
) Deriv1
ON a.post_id = Deriv1.meta_value
WHERE a.meta_value = 1
AND a.meta_key = 'type-select'
AND b.post_status = 'publish'
and post_type = 'car-cc'
当前的问题SQl STATEMENT
是,当我提供meta_value =1
它时,它正在获取所有值,即还列出post_id
了没有的值。meta_value =1