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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Combining multiple rows into single column

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-03-02 : 08:47:08
Rajan writes "I'm working on a Reports and I need to combine data from multiple
rows (with the same EventDate) into one comma separated string. This is how the data is at the moment:

EmployeeID EventDate
2309 2005-10-01 00:00:00.000
2309 2005-10-01 03:44:50.000
2309 2005-10-01 08:59:00.000
2309 2005-10-01 09:29:44.000

I need it in the following format:

EmpID EventDate EventTime
2309 2005-10-01 00:00:00,03:44:50,08:59:00,09:29:44

There is no definite number of EventTime per Employee for a particular EventDate. And i don't want to use Iterative Methods.

Thanks & Regards
Rajan"

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-02 : 09:26:45
Yes, this is possible and have been asked almost a million times here at SQLTeam.
http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx

Is this copyrighted Peter ?


KH

Go to Top of Page
   

- Advertisement -