group_concat函数的功能是将某一字段的值按指定的字符进行累加,系统默认的分隔符是逗号
注意:group_concat 函数有长度限制,默认长度是1024,可以使用以下两个方法解决:
转自: https://www.pianshen.com/article/73801583369/
换其他数据库一个 sum() over (partition by ... )就解决了..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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)