I would use union all
, tricks in order by
cannot use index and slower.
SELECT * FROM ((SELECT 1 AS a, @rownum: =@rownum +1 B, post_status, post_date, post_title FROM wp_posts, (SELECT @rownum:=0) r WHERE post_status='publish' ORDER BY post_date DESC) UNION ALL (SELECT 2 AS a, @rownum: =@rownum +1 B, post_status, post_date, post_title FROM wp_posts, (SELECT @rownum:=0) r2 WHERE post_status='future' ORDER BY post_date)) ORDER BY A,B;
source share