Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Tapalotapus
Starting Member
22 Posts |
Posted - 2005-10-10 : 00:25:32
|
| What I'm trying to do is group by the date (DTE) but I want the text value (TEXTER) for each matching date to be strung together with a comma delimiter. I know I can do a group by the date then loop through the records for each date and build the string but I know there has to be a set based way to do this easily?Thanks CREATE TABLE #wowo ( RowID int IDENTITY(1,1), DTE DATETIME, TEXTER NVARCHAR(10) )INSERT INTO #wowo(DTE,TEXTER)VALUES('1/1/05', 'A')INSERT INTO #wowo(DTE,TEXTER)VALUES('1/1/05', 'B')INSERT INTO #wowo(DTE,TEXTER)VALUES('1/1/05', 'C')INSERT INTO #wowo(DTE,TEXTER)VALUES('1/2/05', 'A')INSERT INTO #wowo(DTE,TEXTER)VALUES('1/2/05', 'B')INSERT INTO #wowo(DTE,TEXTER)VALUES('1/2/05', 'C')INSERT INTO #wowo(DTE,TEXTER)VALUES('1/2/05', 'D')INSERT INTO #wowo(DTE,TEXTER)VALUES('1/3/05', 'A')------ Expected results ----------DTE TEXTER1/1/05 A,B,C1/2/05 A,B,C,D1/3/05 A |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
Tapalotapus
Starting Member
22 Posts |
Posted - 2005-10-10 : 00:57:41
|
| Thanks Madhivanan, I will read it over. |
 |
|
|
|
|
|
|
|