我正在写:
select concat(col1 , '|', col2 , '|', col3 , '|', col4 ,'|', col5)
我尝试使用AS获取列名,但出现错误。
concat(col1 as parent, '|', col2 as child, '|', .....)
输出也应具有单独的列名。我需要标题-应该是列名:
parent|child|date|year|month
答案 0 :(得分:0)
大概,您想要这样的东西:
select str
from (select 'parent, child, . . . ' as str, 1 as ordering
union all
select concat(col1, '|', col2, '|', col3, '|', col4, ' |', col5) as str
from t
) t
order by ordering;