hi every one

my problem is is to convert id column values as comma separated

ex: id
1
2
3
4
5
6
i want result set as string "1,2,3,4,5,6,7....."

Recommended Answers

Look up group_concat: select group_concat(id) from <yourtablenamehere> group by ''

Jump to Post

All 4 Replies

Look up group_concat: select group_concat(id) from <yourtablenamehere> group by ''

Look up group_concat: select group_concat(id) from <yourtablenamehere> group by ''

it is not working for primary key column

Yes it is. Have a close look at my example, especially the group clause.
If it does not work for you, show your table definition and the code.

i got the result by following statement :

select group_Concat(convert(id,char)) as idKey from users

thanks for spending time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.