特殊应用
 
                  更新时间 2025-02-14 10:21:33
                 
 
                    最近更新时间: 2025-02-14 10:21:33
                  
 本文为您介绍SELECT语法的特殊应用场景,例如多行变成单行和一列变成多行。
 - 多行变成单行 - teledb=# select array_to_string(array(select nickname from teledb_pg1),','); array_to_string ----------------- test,pg (1 row)
- 一列变成多行 - teledb=# insert into teledb_pg1 values(6, 'teledb, teledb1'); INSERT 0 1 teledb=# select regexp_split_to_table((select nickname from teledb_pg1 where id=6 limit 1), ','); regexp_split_to_table ----------------------- teledb teledb1 (2 rows)
