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.
| Author |
Topic |
|
t1g312
Posting Yak Master
148 Posts |
Posted - 2003-12-24 : 07:43:08
|
| Hi all,I have a table that has 3 fields: id, Field and value. I need to create a view which has some of these "Fields" as column names and value as column values. How do I do that?TIAAdi-------------------------/me sux @sql server |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-12-24 : 08:02:42
|
| Search this site and forums for "crosstab" or "pivot" queries. Basically you'll get something to the order of :SELECT SUM(CASE Field WHEN x THEN value else 0 END) AS x,SUM(CASE Field WHEN y THEN value else 0 END) AS y,...OwaisWe make a living out of what we get, but we make a life out of what we give. |
 |
|
|
|
|
|