Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
MSSQL:
select state,
( select city+',' as 'data()' from dbo.test t2 where t1.state=t2.state for xml path('') )
from dbo.test t1
group by state
SELECT
state,
GROUP_CONCAT(city)
FROM your_table
GROUP BY state
select state, group_concat(city separator ",") from ... group by state
You have SQL Server, judging by the screenshot from SQL Server Management Studio. There is no group_concat(), the simplest solution can be found here: stackoverflow.com/questions/451415/simulating-grou...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question