(2)使用内建聚合函数实现
select name,
split_part(split_part(tmp,',',3),':',2) as "语文",
split_part...数学 | 英语
------+------+------+------
张三 | 80 | 70 | 60
李四 | 90 | 100 | 80
(2 rows)
在子查询中按...select c1,coalesce(c2,'')||':1,'||coalesce(c3,'')||':2,'||coalesce(c4,'')||':3' c2...c1,string_to_array(c2,',') c2
test(# from (select c1,coalesce(c2,'')||':1,'||coalesce...unnest() with element number
POSTGRESQL交叉表的实现
PostgreSQL 一行变多行