1. 程式人生 > >mysql根據時間統計數據語句

mysql根據時間統計數據語句

creat 數據 ner etime user tro unixtime use create

select FROM_UNIXTIME(`createtime`, ‘%Y年%m月%d日‘)as retm,count(*) as num from `user` GROUP BY retm

select FROM_UNIXTIME(`pay_tm`, ‘%Y/%m/%d::‘)as retm,sum(price)+sum(express_price) as num from `order_orderlist` GROUP BY retm;

select FROM_UNIXTIME(`pay_tm`, ‘%Y/%m/%d::‘)as retm,SUM(a2.`num`) AS num from `order_orderlist` as a1 INNER JOIN `order_orderlistrow` as a2 on a1.`id` = a2.`order_orderlist_id` GROUP BY retm;

select FROM_UNIXTIME(`pay_tm`, ‘%Y/%m/%d::‘)as retm,count(*) as num from `order_orderlist` GROUP BY retm;

mysql根據時間統計數據語句