select
userid,
group_concat(distinct name,',')as name_list
from
your_table
where time = 2023xxxx
group by userid
select
userid,
group_concat(distinct name,',')as name_list
from
your_table
where time = 2023xxxx
group by userid