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 |
|
8022421
Starting Member
45 Posts |
Posted - 2009-06-04 : 03:44:54
|
| HI,I have a table in the below formatDATE NOTES2009/02/03 MIGRATION1 IS FINE2009/02/03 MIGRATION2 IS FINE2009/02/04 MIGRATION3 IS FINE2009/02/05 MIGRATION4 iS FINEMy requirement output should in the below format.DATE NOTES2009/02/03 MIGRATION1 IS FINE , MIGRATION2 IS FINE2009/02/04 MIGRATION3 IS FINE2009/02/05 MIGRATION4 iS FINEBasically I need to sum up the Notes column based on the date, Can this be done with out using a cursor..Please advise.. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
kunal.mehta
Yak Posting Veteran
83 Posts |
Posted - 2009-06-04 : 05:24:05
|
| Hi,try thisSELECT dt, STUFF( ( SELECT ',' + comments FROM test12 o where o.dt=o1.dt FOR XMLPATH('')),1 ,1, '') from test12 o1group by dtorder by dtcreate table test12(dt datetime,comments varchar(20))Kunal |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-04 : 13:04:37
|
quote: Originally posted by kunal.mehta Hi,try thisSELECT DISTINCT dt, STUFF( ( SELECT ',' + comments FROM test12 o where o.dt=o1.dt FOR XMLPATH('')),1 ,1, '') from test12 o1group by dtorder by dtcreate table test12(dt datetime,comments varchar(20))Kunal
|
 |
|
|
|
|
|
|
|