mysql中datetime比较大小

select sum(studychj) as tofflinejz from afterline where checkflag=1 and studytype=1 and studybegin>='2010-01-01 00:00:00' and studyend<='2010-12-01 00:00:00' and username='01009'


这么写不报错,但得出结果不许确函数

方法一:unix

你也能够:
select * from t1 where unix_timestamp(time1) > unix_timestamp('2011-03-03 17:39:05') and unix_timestamp(time1) < unix_
timestamp('2011-03-03 17:39:52');
就是用unix_timestamp函数,将字符型的时间,转成unix时间戳。我的以为这样比较更踏实点儿。select

方法二方法

select DATE_FORMAT('2015-06-06 23:22:26','%Y-%m-%d')im

相关文章
相关标签/搜索