Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
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
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 minsomething 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)tGROUP BY ID
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2008-07-25 : 03:18:22
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254MadhivananFailing to plan is Planning to fail