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)
 Help required in a Query !

Author  Topic 

sqlilliterate
Starting Member

40 Posts

Posted - 2008-01-29 : 08:16:41
Help me achieving a query …

My table look like


col1 col2
-------------------
a 1
a 2
a 3
b 1
b 2

and I want the output as…

col1 col2 col3 col4
----------------------------------------
a 1 2 3
b 1 2


The col2 values should be populated as different columns for the col1 value

Thanks
:)

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-29 : 08:20:21
The only two ways to go is the PIVOT or the "multiple case" way.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -