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 2000 Forums
 Transact-SQL (2000)
 Cross tab/pivot unknwon number of rows

Author  Topic 

SoftFox
Starting Member

42 Posts

Posted - 2008-02-19 : 05:09:13
This is a classic problem but i need the highest performance solution to this:

A data set has the rows:

1, X
1, Y
1, Z
2, A
2, B

This needs to be selected as:

1, X Y Z
2, A B

where the number of rows for each group (1, 2) is unknown. What is the best way to acheive this?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-19 : 05:12:49
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=53293

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-19 : 09:56:03
refer this too:-
http://www.mssqltips.com/tip.asp?tip=937
Go to Top of Page

SoftFox
Starting Member

42 Posts

Posted - 2008-02-20 : 09:42:11
yes the article helps, i think the function method works the best.
Go to Top of Page
   

- Advertisement -