SELECT
a.date,
COUNT( um.id ) quantity
FROM
(
SELECT
@num := @num + 1 num,
date_format( adddate( '2021-12-01', INTERVAL @num DAY ), '%Y-%m-%d' ) AS date
FROM
visit_record,(
SELECT
@num :=- 1
) t
) a
LEFT JOIN user_member um ON DATE_FORMAT( um.auth_time, '%Y-%m-%d' )= a.date
AND um.auth = 1
WHERE
a.date BETWEEN '2021-12-01'
AND '2021-12-31'
GROUP BY
a.date
注意有个前提:必须要有一个表,它的数据条数大到足够支撑你要查询的天数