码迷,mamicode.com
首页 > 数据库 > 详细

mysql根据时间统计数据语句

时间:2019-03-02 14:46:24      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:price   mysq   row   语句   inner   order   pre   list   select   

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根据时间统计数据语句

标签:price   mysq   row   语句   inner   order   pre   list   select   

原文地址:https://www.cnblogs.com/daochong/p/10461033.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!