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 |
|
mik
Starting Member
1 Post |
Posted - 2007-02-19 : 05:28:06
|
| Hi, i'm trying to port a pivot query from access to sqlserver.I'm trying this query:SELECT IDMerce, [1] AS [Department-1], [2] AS [Department-2], [3] AS [Department-3], [4] AS [Department-4]FROM (SELECT IDMerce, Pezzi, IDMagazzino FROM Disponibilita) p PIVOT (sum(Pezzi) FOR IDMagazzino IN ([1], [2], [3], [4])) AS pvtthis works, but in my case i don't know in advance how many transformations i need, so there is a solution?Thanks |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2007-02-19 : 06:25:20
|
| 1. put presentation items into your front-end....sql-server is backend.2. if you must go down this route...have a look at the robvolk' article on dynamic pivot in SQL. |
 |
|
|
|
|
|