I am making an express web app and as part of it I am querying an SQL database that has a table of users (dbo.tbl_user
with data such as name, role, email etc.
I want to query the DB so that a list of names are returned in comma separated values. When I use 'SELECT name FROM dbo.tbl_user'
I get:
[
{
"name": "Tom"
},
{
"name": "Dick"
},
{
"name": "Harry"
}
]
however I want
[
"Tom","Dick","Harry"
]
Searching online I can only find ways of getting back [{"Tom,Dick,Harry"}]
which is not what I want as the values are not separated out. Any help would be greatly appreciated.