Check out the Latest Articles:
sql基于时间查询(select)

返回所有posts表中,2009年5月13号到16号的记录。created是posts表的timestamp。

select * from posts where date(created) bettwen date(2009-05-13) and date(2009-05-16)

除了date(),还有year(),month(),day()可以使用。year(2009-05-13) 返回2009,month(2009-05-13)返回05,day(2009-05-13)返回13

Happy Coding…



  1. Mr WordPress on Friday 15, 2009

    Hi, this is a comment.
    To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.

  2. Alicia on Friday 15, 2009

    Upup :)