我有这个
SELECT COUNT(1) cnt, a.auther_id
FROM `posts` a
LEFT JOIN users u ON a.auther_id = u.id
GROUP BY a.auther_id
ORDER BY cnt DESC
LIMIT 20
它工作正常,但现在我想要在最后一天内选择帖子。我试着用
WHERE from_unixtime(post_time) >= SUBDATE(NOW(),1)
但它不起作用。任何人都知道为什么?
答案 0 :(得分:0)
这可能有效:
WHERE FROM_UNIXTIME(post_time) >= SUBDATE(NOW(), INTERVAL 1 DAY)