你在找这样的东西吗?
SELECT *
FROM users
ORDER BY (COALESCE(subs_end_datetime, 0) <= CURDATE()), id
这是 SQLFiddle 演示
根据您的评论
SELECT *, subs_end_datetime <= CURDATE() aa
FROM users
ORDER BY (COALESCE(subs_end_datetime, 0) <= CURDATE()), subs_end_datetime DESC
这是 SQLFiddle 演示
这样我们就会显示订阅尚未结束的用户。我们在查询中使用>=
<=
{}} {}} {}
null
示例: http://sqlfiddle.com/#!2/a255c/18