How do I return query results as a comma separated list in SQL?
Asked by Laurie Huth:

**Issue:** I am using the *Jira Issue/Filter* macro in a Confluence page. In Jira, there is a list of items selected. I want to have commas or semi commas when I pull it into Confluence.

For example, currently in Jira there is an*External Document* field:

![Screenshot 2022-04-08 100405.png](https://community.atlassian.com/t5/image/serverpage/image-id/192185i6BD3333F2EDB31C9/image-dimensions/548x28?v=v2 "Screenshot 2022-04-08 100405.png")

Then the table cell in Confluence shows: (note, no commas or anything to separate the list)

![Screenshot 2022-04-08 100526.png](https://community.atlassian.com/t5/image/serverpage/image-id/192186iB4D8591DC1441A55/image-dimensions/152x119?v=v2 "Screenshot 2022-04-08 100526.png")

**Question:** How do I enter commas or semicolons or something to separate each item?

Here is my SQL so far:

FORMATWIKI(SUM("External: " + 'External Document')) AS 'Resources'


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Laurie Huth](/t5/user/viewprofilepage/user-id/4825705) ,

If I got the case right, in the original table coming from the Jira Issues macro you have a plain row of words without any separations:

\|Client Outreach Client Training Tech Letter VBN\|

Then you just add the "External:" expression to the beginning with the [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro?utm_source=atl_community&utm_medium=answer&utm_campaign=table-filter-traffic-sources&utm_vendorID=1216111) macro.

The problem is that we don't know where/how to break your original string coming from the Jira Issues macro (by special separators, string length, etc.). Physically it is a row of words with spaces. It is only logically that we understand that a correct variant is

\|Client Outreach, Client Training, Tech Letter, VBN\|

and not

\|Client Outreach Client, Training Tech Letter, VBN\|

or smth else.

So, as for now I don't have any ideas. Maybe smth can be done with the original field in Jira so that it will be better displayed in Confluence.

comments: author: Laurie Huth
body: The original field information from Jira (that has comma separators) is from a dropdown list. See images.

The field as it appears in Jira:

![Screenshot 2022-04-08 100405.png](https://community.atlassian.com/t5/image/serverpage/image-id/192211i9C1C586EF2C513F4/image-size/large?v=v2&px=999 "Screenshot 2022-04-08 100405.png")

after choosing options from a dropdown menu in Jira:

![Screenshot 2022-04-08 130055.png](https://community.atlassian.com/t5/image/serverpage/image-id/192212i520064C7F2AFD4AF/image-dimensions/417x141?v=v2 "Screenshot 2022-04-08 130055.png")

Jira automatically put commas into the External Document field shown above, as it knew where the separators were originally. Is there a way to have Confluence pull in the content exactly as it is shown in the field (with the commas). I've been trying to think of some clever workarounds...

Thanks!


author: Katerina Kovriga {Stiltsoft}
body: Unfortunately, I don't have any ideas. The Table Transformer macro won't be of any help because we can't put any splitting logic inside its query.

Maybe you should try to post another question with a different topic (smth regarding "Custom Jira field is poorly displayed in Confluence") and add Jira Issues macro to the hashtags - maybe this question will attract more experienced Jira users. I don't think that your case is unique, maybe there are some workarounds.


author: Madison Small
body: [@Laurie Huth](/t5/user/viewprofilepage/user-id/4825705) were you able to find a solution? I am running into the same issue :(


Tags: confluence-server

server