Linked Questions
66 questions linked to/from How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field?
2451
votes
51
answers
3.4m
views
How to concatenate text from multiple rows into a single text string in SQL Server
Consider a database table holding names, with three rows:
Peter
Paul
Mary
Is there an easy way to turn this into a single string of Peter, Paul, Mary?
113
votes
1
answer
472k
views
Multiple rows to one comma-separated value in Sql Server [duplicate]
I want to create a table valued function in SQL Server, which I want to return data in comma separated values.
For example table: tbl
ID | Value
---+-------
1 | 100
1 | 200
1 | 300
1 | 400
...
49
votes
2
answers
75k
views
What is the equivalent of String.Join on TSQL? [duplicate]
Possible Duplicate:
Is there a way to create a SQL Server function to “join” multiple rows from a subquery into a single delimited field?
Hi all!
I'm looking for an easy way to ...
4
votes
2
answers
11k
views
SQL Server join results as comma separated list [duplicate]
I have a company, industry, and company_industry_map many-to-many table.
company_id | company_name
1 Goldman Sachs
2 Microsoft
industry_id | industry
4 Technology
...
1
vote
3
answers
4k
views
Denormalize into pipe separated list [duplicate]
Possible Duplicate:
Is there a way to create a SQL Server function to “join” multiple rows from a subquery into a single delimited field?
I have a tablle like this:
cust acc
---------...
1
vote
1
answer
4k
views
sql concatenate multiple values [duplicate]
I have designed a view in SQL Server 2008 that displays 2 columns of distinct data in this format:
Column1 Column2
A Text1
B Text2
B Text3
C Text4
D Text5
D Text6
...
2
votes
1
answer
1k
views
SQL Dynamic Column Query [duplicate]
Possible Duplicate:
Is there a way to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field?
I have a table of "Events", and each event has a ...
0
votes
3
answers
218
views
grouping based on name [duplicate]
How do i fetch the details of following table
table1:
c1 c2
ta a
tb c
ta b
tb d
by grouping with same name, like
ta a,b
tb c,d
which function to use in ...
0
votes
2
answers
644
views
Convert multiple rows into one with coma as separator [duplicate]
If I issue SELECT ID FROM TestAhmet I get this result:
1
3
5
2
4
but what I really need is one row with all the values separated by comma, like this:
1,2,3,4,5
How do I do this?
ps: I cant do this :...
-1
votes
2
answers
249
views
T-SQL: Combine rows to one row [duplicate]
I have the following table:
number word
====== ====
1 AAA
2 BBB
2 CCCC
4 CCCC
4 BBB
4 AAA
Now I want to create a new table, where a "number" only occurs in one ...
0
votes
1
answer
89
views
return a string of comma delimited numbers from a sql query [duplicate]
How can I return a comma delimited string using SQL Server?
select ID,
(<<SomeQuery from TableB B where (B.Id = A.TableBId)>>)
from TableA A
and have it return results like:
1, '11, 12'
...
-1
votes
2
answers
58
views
How would I write a T-SQL query to concatenate and group text [duplicate]
I have a table with the following structure:
PERSON Sequence TEXT
1 1 John ran
1 2 across the field
2 1 Bill also
2 2 ran ...
76
votes
8
answers
192k
views
Concatenating Column Values into a Comma-Separated List
What is the TSQL syntax to format my output so that the column values appear as a string, seperated by commas.
Example, my table CARS has the following:
CarID CarName
----------------
1 ...
141
votes
4
answers
325k
views
How to make a query with group_concat in sql server [duplicate]
I know that in sql server we cannot use Group_concat function but here is one issue i have in which i need to Group_Concat my query.I google it found some logic but not able to correct it.My sql query ...
49
votes
2
answers
69k
views
How do I concatenate strings from a subquery into a single row in MySQL?
I have three tables:
table "package"
-----------------------------------------------------
package_id int(10) primary key, auto-increment
package_name varchar(255)
price ...