但是写 SELECT from_unixtime('create_time') AS day_day, sum(total_price) AS day_sum FROM zjr_deal_order WHERE user_id = 999999 GROUP BY from_unixtime('create_time');
执行结果就是 1970-01-01 08:00:00.000000 26.50
goddoger
2017-09-20 15:22:52 +08:00
SELECT SUM(jine) as 总金额 ,username from `order` WHERE addtime='2017-09-10' GROUP BY username
liprais
2017-09-20 15:24:37 +08:00
@treedon from_unixtime('create_time') AS day_day 这个地方是单引号?去掉试试
oongxx
2017-09-20 18:00:25 +08:00
select sum(amount) ... group by userid, orderdate
Cabana
2017-09-20 20:33:51 +08:00
这种事情不是数据库视图干的活吗?直接 SQL 联表查呗
wyk52012
2017-09-21 10:46:04 +08:00
SELECT DATE(gmt_create_date) AS 'order_create_date', SUM(order_total_amount) AS 'daily_order_amount' FROM t_101_s_021_order WHERE gmt_create_date BETWEEN '2017-08-01' AND '2017-09-20' AND user_id = 'you user id' GROUP BY order_create_date;
> 指定时间查询区间 > 指定用户 > 按照日期切割 > 获取单个用户某个日期段内每日的订单额
liuzhen
2017-09-21 11:09:42 +08:00
SELECT date('create_time') AS day_day, sum(total_price) AS day_sum FROM `order` WHERE user_id = 999999 and create_time BETWEEN '2017-08-01' AND '2017-09-20' GROUP BY date('create_time');
treedon
2017-09-21 11:48:24 +08:00
@liprais 可以了...from_unixtime(create_time) 括号里面不能加那个引号,估计当成字符串了,没当成字段名 昨天想回复您的,但是 v2 站说我回复太频繁, 禁了我回复 t t 现在应该可以回复了