I’ve updated this to have the SQL query take care of the date issues, so it’s now:
SELECT
A.post_id,
A.meta_value as startdate,
B.meta_value as enddate
FROM wac_n06_postmeta as A
JOIN wac_n06_postmeta as B on A.post_id
WHERE A.post_id = B.post_id
AND A.meta_value > CURDATE()
AND A.meta_key LIKE 'tour_dates_%_tour_start' AND B.meta_key LIKE 'tour_dates_%_tour_end'
AND SUBSTRING(B.meta_key,12,5) = SUBSTRING(A.meta_key,12,5)
But I still haven’t worked out how to make the matching bit less hacky.
Any help much appreciated!