set @start_date='2022-12-30';
set @end_date='2022-12-31';
WITH recursive Date_Ranges AS (
select @start_date as date
union all
select date + interval 1 day from Date_Ranges
where date < @end_date
)
SELECT
new_table.*,
(
SELECT
group_concat(`time`)
FROM
`clockin`
WHERE
`emid`=new_table.`id` AND
`date`=new_table.`date`
) as `time`
FROM
(select * from `user` full join Date_Ranges) as new_table
order by date desc
1条答案
按热度按时间piah890a1#
试试这个: