try this:
SELECT ReportId, Email =
STUFF((SELECT ', ' + Email
FROM your_table b
WHERE b.ReportId = a.ReportId
FOR XML PATH('')), 1, 2, '')
FROM your_table a
GROUP BY ReportId
SQL fiddle demo
More Related Contents:
- I dont know sql syntax for my table [closed]
- Insert local .csv data in remote SQL Server via already working connection string
- Syntax combine two stored procedure into one [closed]
- How to delete duplicate rows in SQL Server?
- CROSS JOIN vs INNER JOIN in SQL
- How to cast the DateTime to Time
- How to update Identity Column in SQL Server?
- Concatenate values based on ID
- How to convert an integer (time) to HH:MM:SS::00 in SQL Server 2008?
- What is the order of execution for this SQL statement
- Splitting delimited values in a SQL column into multiple rows
- How to import text files with the same name and schema but different directories into database?
- Detect consecutive dates ranges using SQL
- Select a Column in SQL not in Group By
- Split values over multiple rows [duplicate]
- How to do an inner join on row number in sql server
- How can I alter this computed column in SQL Server 2008?
- Stored procedure that exports data into csv files only exports to one file
- SQL Server: should I use information_schema tables over sys tables?
- TSQL – How to use GO inside of a BEGIN .. END block?
- SQL take just the numeric values from a varchar
- How do I change db schema to dbo
- Count records for every month in a year
- How to export data from Excel spreadsheet to Sql Server 2008 table
- SQL Server: +(unary) operator on non-numeric Strings
- Use one CTE many times
- Bulk insert using stored procedure
- Connect different Windows User in SQL Server Management Studio (2005 or later)
- How to Select Every Row Where Column Value is NOT Distinct
- How to automatically generate unique id in SQL like UID12345678?