mysql比较麻烦, 可以试下
select a.Daytime,sum(new_Role)
from (select distinct DATE_FORMAT(createtime,'%Y-%m-%d') as Daytime)
from `actors` WHERE ( (`createtime` >= '2019-02-01 00:00:00') AND (`createtime` <= '2019-02-11 24:00:00') )
) a
left join (select * from `actors`
WHERE ( (`createtime` >= '2019-02-01 00:00:00') AND (`createtime` <= '2019-02-11 24:00:00') )
)b
on a.Daytime>=b.createtime
group by a.Daytime
order by 1
---由于我是在window环境下运行,我把FROM_UNIXTIME去掉,才能运行。select
tablename_tmp.*
--,@pstatus :=concat(CONCAT(@pstatus,'+'),@ptempstatus) as countstatus
,@pstatus :=concat(@pstatus,@ptempstatus) as prevstatus
,@ptempstatus :=concat('+',COUNT)
from
(
select DATE_FORMAT(FROM_UNIXTIME(order_time),'%Y-%m-%d') as TIME,COUNT(*) AS COUNT from user_order group by time
) tablename_tmp
,
(select @pstatus := '',@ptempstatus := '1' ) a
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)