CONCAT_WS(separator, str1, str2,...) 多列转1列,以分割符分割 使用场景: 1.多列在一列显示: 2.多列转多行作为辅助,结合split和explode使用 SELECT DISTINCT a2.dt,a2.userid,type FROM ( SELECT a1.dt,a1.userid,split(CONCAT_WS(',',a1.a,a1.b,a1.c),',') as types FROM (select dt,userid,a,b,c from ta