以下のように2つのクエリがあります。
A SELECT DISTINCT meta_value, meta_id FROM `wp_postmeta` WHERE `meta_key`='destination';
B SELECT ID FROM wp_posts WHERE post_status = 'publish';
私が欲しいのは、このようなものです。
SELECT meta_value FROM A WHERE A.meta_id = B.ID;
SELECT DISTINCT
meta_value
FROM `wp_postmeta` wpm,
wp_posts wp
WHERE wp.ID = wpm.meta_id
AND wpm.`meta_key` = 'destination'
AND wp.post_status = 'publish';
これを試して
SELECT A.meta_value, A.meta_id
FROM `wp_postmeta` A
INNER JOIN wp_posts B
ON meta_id = id
WHERE A.`meta_key`= 'destination'
AND B.post_status = 'publish'
GROUP BY A.meta_value