Possible Duplicate:
Simulating group_concat MySQL function in MS SQL Server 2005?
I have two table namely ServiceEntryPart
and Part
. One service entry could have multiple parts. What I am trying to do is to concatenate different parts for the same service entry. The final entry I am looking for is to have something like below"
ServiceEntryID PartDescription
3 2 ~ xyz Manager | 3 ~ Elevator
In the Column Part Description, different part ids are concatenated in one column by using part id first followed by a tilda and part description followed by a Pipe character and the same format for different parts in the serviceentry part. Any help would be appriciated. thanks
please find the structure below
dbo.ServiceEntryPart
ID ServiceEntryID PartID
266 2 1
234 3 2
234 3 3
233 5 4
dbo.Part
ID PartDescription
1 Sample Manager
2 xyz Manager
3 Elevator