Linked Questions
112 questions linked to/from How to make a query with group_concat in sql server
382
votes
10
answers
196k
views
Simulating group_concat MySQL function in Microsoft SQL Server 2005?
I'm trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not by choice, but that's life).
In the original app, we used almost entirely ANSI-SQL compliant statements, with one ...
2
votes
4
answers
17k
views
Return Comma separated values SQL [duplicate]
I have a field names DAILYREPORT.WEATHERCONDITION which can hold values as '1,2,3' or '1' or '2,4' based on what the user selects from the list of weather check boxes available to him. The weather ...
2
votes
1
answer
7k
views
GROUP_CONCAT for SQL Server [duplicate]
I have done some searching and can see that this question has been asked several times before, but I can't seem to translate the solutions into my own working example. Can anyone point me in the ...
0
votes
3
answers
1k
views
Merge data many rows of one column into a single row in sql server [duplicate]
I have a table like
create table temp_table (col1 int)
I have some data in this table like
insert into temp_table
values(1), (2), (3), (4)
Now I want the data to be output as follows:
1,2,3,4
I ...
-1
votes
1
answer
3k
views
Selecting with LEFT OUTER JOIN and return as comma-separated list [duplicate]
On MS SQL Server 2008, how do I make a select statement, that joins two tables, and return the content of table 2 as a comma-separated list?
Example:
Table 1 contains all my orders, and table 2 my ...
0
votes
3
answers
879
views
Add two nvarchar columns using T-SQL [duplicate]
Table structure
CREATE TABLE [dbo].[StackQuestion]
(
[ID] [BIGINT] IDENTITY(1,1) NOT NULL,
[Product_Id] [BIGINT] NULL,
[Quantity] [DECIMAL](18, 6) NULL,
[Description] [NVARCHAR](MAX) ...
-1
votes
3
answers
623
views
How to get complex values as columns [duplicate]
I have three tables:
contacts
contact_phones
phone_types
Each contact from table contacts has multiple phone numbers in table contact_phones, and each phone number has a type_id from table ...
0
votes
0
answers
265
views
Alternative to Group_concat in MS SQL Server [duplicate]
I have a simple query that does group concat very well in SQL workbench.
id hobby
1 dance
1 sing
2 play
2 sing
Expected output:
id hobby
1 dance,sing
2 play,sing
How can I get this output ...
1
vote
2
answers
98
views
Subquery result into one row [duplicate]
for example I have two table like this :
Table Parent
+===========+==============+
| FirstName | (PK)LastName |
+===========+==============+
| Bob | Newbie |
| Bella | Goth |
+...
0
votes
0
answers
171
views
Generate single row from multiple rows [duplicate]
I was working on stored procedure to return rows with columns from multiple table
First Table- Product Variant
Columns are - Sku, Name, Price, MRP, Cost
Second Table - Sku_Mrp_Mapping
Columns are ...
-1
votes
1
answer
148
views
Converting multiple rows into one column SQL Server 2008 [duplicate]
I have a query with results shown below. As you can see, the grp_code column is the same.
I want to make a string out of the find_description column and have the results show in one column. I have ...
0
votes
3
answers
69
views
Selecting person and their multiple letter ids? [duplicate]
Trying to use sql to grab all users from a location "E.g. Boston" and grab all their letter ids. For example it should return something similar to this:
username | letterID
Sam Smith | 5278665, ...
0
votes
1
answer
96
views
How can I concatenate all the occurrences (1..N) in this query/relation (SQL Server)? [duplicate]
I've got this query:
SELECT R.Unit, LU.ReportName, R.Generated, E.EmailAddr, R.BeginDate, R.EndDate
FROM ReportsGenHistory R
JOIN ReportsLU LU ON R.ReportID = LU.ReportID
JOIN ReportsUnitEmails E ON ...
0
votes
0
answers
86
views
SQL Query to Concatenate text [duplicate]
I am trying to find the best way to consolidate the string in the fields that have the same value. Please look at the example below:
Table1:
Column1 | Column2 | Column3 | Column4
test1 test2 ...
1
vote
1
answer
65
views
Connect together different values with splitter that have been grouped by [duplicate]
In picture result is what result of that UNION ALL inner select looks like.
I'm having troubles connecting together values assigned to same ID.
In inner select I can get multiple same ID results, but ...