mysql 时间比较实例

//时间比较
1》select * from userinfo where UNIX_TIMESTAMP(uptime)>UNIX_TIMESTAMP('2012-05-20 0:00:01')

2》select self_name,uptime from works where TO_DAYS(uptime) >= TO_DAYS('2012-07-25') and TO_DAYS(uptime) <= TO_DAYS('2012-07-31')

 

//每天投票人数:
select count(distinct(rrid)) as '多少人投票', DATE_FORMAT(uptime,'%Y-%m-%d') as "时间" from vote_record group by TO_DAYS(uptime)

 

你可能感兴趣的:(mysql 时间比较实例)