开发者

mysql problem left join and from_unixtime

I have this开发者_如何学JAVA

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?


This may work:

WHERE FROM_UNIXTIME(post_time) >= SUBDATE(NOW(), INTERVAL 1 DAY)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜