MYSQL 时间格式化转换与每小时数据查询SQL

select userid,username,hour(FROM_UNIXTIME(regdate)),count(*) as tatol,DATE_FORMAT(FROM_UNIXTIME(regdate), '%Y-%m-%d') as datetime

from em_member

where DATE_FORMAT(FROM_UNIXTIME(regdate), '%Y-%m-%d') = '2014-03-26'

group by hour(FROM_UNIXTIME(regdate))

你可能感兴趣的:(MYSQL 时间格式化转换与每小时数据查询SQL)