select case role when 'MENTOR' then 'USTAR' when 'STUDENT' then 'STUDENT' else role end as role,
sum(case when created_date >= '2019-08-14 00:00:00' and created_date <= '2019-08-21 00:00:00' then 1 else 0 end) as added,count(2) as total
from user
group by role;
通过html格式转换,结果如下