更新时间:2023-12-01 19:26:46
您可以使用函数 concat_ws
跳过 null
值.
You can use the function concat_ws
which skips the null
values.
select username,
concat_ws(','
,case when admin_for_blog is not null then 'ADMIN' end
,case when editor_for_blog is not null then 'EDITOR' end
,case when author_for_blog is not null then 'AUTHOR' end
)
from account