mysql 问题 left join 和 from_unixtime
我有这个
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)
但没有成功。有人知道为什么吗?
I have this
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
It works fine, but now I want select posts from within the last day. I tried to use
WHERE from_unixtime(post_time) >= SUBDATE(NOW(),1)
but it didn't work. Any one have idea why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能有效:
This may work: