为了账号安全,请及时绑定邮箱和手机立即绑定

时间戳统计问题

老师,   表字段, 存的是时间戳    现在要根据时间 来分别统计 年 月 日的数据 ,这个该怎么优化呢,因为索引字段只要用到函数 就会失效。。。  

正在回答

1 回答

select count(time_column) from your_table group by year(from_unixtime(time_column))或者by month(from_unixtime(time_column))或者dayofyear(from_unixtime(time_column))


from_unixtime: 时间戳转时间

unix_timestamp: 时间转时间戳

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

时间戳统计问题

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号