常用sql:按照表中的某一列对数据进行分组,统计数据条数

select FROM_UNIXTIME(start_time,'%Y-%m-%d')as date,COUNT(*) FROM random_num GROUP BY FROM_UNIXTIME(start_time,'%Y-%m-%d')  

sql解释:在 random_num 表中将 start_time 按照 Y-m-d 的格式 进行分组,统计每天的数据条数

let the world have no hard-to-write code ^-^
原文地址:https://www.cnblogs.com/ovim/p/11185505.html