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)
 sql pivot

Author  Topic 

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-03-31 : 06:42:33
hi,
how can I use a select statement in the IN part of the pivot sql instead of ([1],[2],[3])

eg,
I want to do :

PIVOT ( sum(numbers) FOR surname IN (Select surname from person)

that doesn't work though.

any ideas.?


thank you

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-03-31 : 06:44:14
i've built the list dynamically when i've needed to do it this way. if there's a better way i'd love to hear it too

Em
Go to Top of Page
   

- Advertisement -