正常select * from table,数据结构如图:
现需要将第一行的四个数量转为列,即原有3条数据变为12条数据。
语法应用:unnest
Select id,
title,
unnest(array ['1_num', '2_num', '3_count', '4_num']) as point,
unnest(array [1_num, 2_num, 3_count, 4_num]) as point_num,
to_char(publish_time, 'HH24:MI') publish_time
from table