开发者

MySQL date comparison issue

I have the date in 开发者_Go百科this format in mySQL databse:

2011-02-21 14:40:03

But i have to compare only datepart of this dateandtime i.e:

2011-02-21

How???


A better solution is to use WHERE col >= '2011-02-21' AND col < '2011-02-22', so MySql can use a index if there is one present.


... where date(datetime_column) = '2011-02-21'

Here is the documentation

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜