62,634
社区成员




SELECT
create_date,
sum(case when STATUS = '0' then'1' else '0' end) c0 ,
sum(case when STATUS = '1' then '1' else '0' end) c1,
sum(case when STATUS = '2' then '1' else '0' end) c2,
sum(case when STATUS = '3' then '1' else '0' end) c3
FROM
user_status
WHERE
create_date < STR_TO_DATE('2021/03/24', '%Y/%m/%d')
AND create_date >= STR_TO_DATE('2021/03/17', '%Y/%m/%d')
GROUP BY
create_date
ORDER BY
create_date
SELECT DATE_FORMAT(create_time,'%m-%d') as time,status,count(id)
FROM table
WHERE create_time<=#{endTime} and create_time>=#{startTime}
GROUP BY time,status
ORDER BY time asc