LISTAGG equivalent in Teradata

前端 未结 1 2055
梦如初夏
梦如初夏 2021-01-06 19:04

Is there any equivalent of Listagg function of oracle in teradata. With recursive is an option I have tried, but wanted something other than.

Thanks Aritra

相关标签:
1条回答
  • 2021-01-06 19:51

    If Teradata's XML-services are installed (default since 14.10?) there's a function named XMLAGG, e.g.

    SELECT DatabaseName, TABLENAME, 
       TRIM(TRAILING ',' FROM (XMLAGG(TRIM(Columnname)|| ',' ORDER BY ColumnId) (VARCHAR(10000))))
    FROM dbc.ColumnsV
    WHERE databasename = 'dbc' 
      AND TABLENAME = 'ColumnsV'
    GROUP BY 1,2
    
    0 讨论(0)
提交回复
热议问题