0

I know this question has been asked before here, but for SNOWSQL in particular, is there a function similar to 'STUFF' to combine two values into a single record? I basically want to be able to use this query:

               SELECT ISSUE_ID,
               STUFF((SELECT ', ' + AFFECTS_VERSION
               FROM VW_JIRA_ISSUES
               WHERE ISSUE_ID = T.ISSUE_ID
               FOR XML PATH (''), type) ).value('.', 'varchar(max)'), 1, 1, '')               
               AS VERSIONS
               FROM VW_JIRA_ISSUES
               GROUP BY ISSUE_ID
theduck
  • 2,589
  • 13
  • 17
  • 23
Emily P
  • 1
  • 1
  • I actually ended up using Snowflake's LISTAGG FUNCTION: `select issue_id, listagg(AFFECTS_VERSION, ', ') within group (order by issue_id desc) FROM VW_JIRA_ISSUES group by issue_id` – Emily P Oct 08 '19 at 20:27

2 Answers2

0

How about Snowflake's INSERT() function? I understand it is basically the same as MySQL's INSERT() function which in turn is the equivalent of STUFF() in SQL Server.

References:

Suzy Lockwood
  • 1,050
  • 4
  • 6
0

select issue_id, listagg(AFFECTS_VERSION, ', ') within group (order by issue_id desc) FROM VW_JIRA_ISSUES group by issue_id

Emily P
  • 1
  • 1