不确定你的空时null还是空字符串,先假设是null
select * from (
select a.*,
row_number() over(partition by job_id order by level desc) rn
from test_20220411_a a) b
where rn=1 or level is null
select min(id) id,job_id,max(name) name,
concat(max(skills),'-',max(level)) `skills-level`,
GROUP_CONCAT(concat(project,'-',role)) `project-role`,
group_concat(lessones) lessones,
sum(score) score
from (
select a.*,
row_number() over(partition by job_id order by level desc) rn
from test_20220411_a a) b
where rn=1 or level is null
group by job_id
如果,实测如果空值是null的话,group_concat并不会造成数据里有多余分隔符,所以如果你的数据是空字符串,那么可以在最内层select的时候,用case when转换成null