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)
 Concatinate search

Author  Topic 

baska123
Yak Posting Veteran

64 Posts

Posted - 2008-07-24 : 16:03:15
I have one ID but many Desiners under that ID. How do I concatinate the designers so they show up in one column? Is this possible?

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2008-07-24 : 16:20:56
read about PIVOT
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-25 : 00:56:53
or use group by and apply aggregate function like max or min

something like

SELECT ID,
MAX(CASE WHEN RowNo=1 THEN DesignerID ELSE NULL END) AS Designer1,
MAX(CASE WHEN RowNo=2 THEN DesignerID ELSE NULL END) AS Designer2,
MAX(CASE WHEN RowNo=3 THEN DesignerID ELSE NULL END) AS Designer3,...
FROM
(SELECT ROW_NUMBER() OVER (PARTITION BY ID ORDER BY DesignerID) AS RowNo,*
FROM YourTable)t
GROUP BY ID
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-25 : 03:18:22
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -