sql中如何将多列用一点合并成一列查询出

选择(Segment1(01)+'.'+Segment2(01-02-03)+'.'+Segment3(0000))作为别名。

sql里怎么把一列的值合并成一个字符串

1.创建测试表,

createtabletest_str_concat(idvarchar2(20),valuevarchar2(20));

2.插入测试数据

insertintotest_str_concatvalues(1001,9001);

insertintotest_str_concatvalues(1002,9002);

insertintotest_str_concatvalues(1003,9003);

insertintotest_str_concatvalues(1004,9004));

insertintotest_str_concatvalues(1005,9005);

提交;

3.查询表全量数据,selectt.*,rowidfromtest_str_concatt;

4.编写sql,使用listagg函数将value列中的数据组合成字符串;

selectlistagg(value,',')withgroup(orderbyid)strfromtest_str_concatt;拼接后的结果为:9001,9002,9003,9004,9005