根据我对您问题的理解,解决方案是使用SQL运算符;“联合”;,如以下示例所示。
SELECT res.id, res.name, res.date, res.rowOrder
FROM (
SELECT id, name, date, 1 as rowOrder
FROM users u
WHERE u.name = \'JohnD\'
UNION
SELECT id, name, date, 2 as rowOrder
FROM users u
WHERE u.name != \'JohnD\'
) res
ORDER BY res.rowOrder, res.date;
您可以在以下位置查看我的测试:
https://sqltest.net/#1547933我让您添加Wordpress包装器(WP_Query) 到您的查询。