以下语句未测,其中一个enter_loc对应多个name;
mysql
SELECT enter_loc, GROUP_CONCAT(distinct name) from tab group by enter_loc ;
oracle
select enter_loc,replace(wm_concat(name),',',';') from tab group by enter_loc; -- 老版本可用
select enter_loc,listagg(distinct name,',')within group(order by name) from tab group by enter_loc; -- 新版本可用