MySQL计数日期(MySQL count date)
为什么会这样呢?
在特定日期之前,此查询不应该检索记录数吗?
SELECT count(*) FROM `posts` WHERE date < 2013-01-01我在db上有几条与查询匹配的记录,但是,计数为0
我究竟做错了什么??
Why is this happening
Shouldn't this query retrieve the number of records until a specifc date?
SELECT count(*) FROM `posts` WHERE date < 2013-01-01I have several records on the db that match the query, however, the count comes 0
What am I doing wrong??
最满意答案
您需要使用DATE将字符串定义为DATE
SELECT count(*) FROM posts WHERE date < DATE('2013-01-01')You need to define your string as a date using DATE
SELECT count(*) FROM posts WHERE date < DATE('2013-01-01')更多推荐
发布评论