You are here: Re: pivot table without aggregation? « MsSQL Server « IT news, forums, messages
Re: pivot table without aggregation?

Posted by Plamen Ratchev on 03/30/07 02:31

"Ed Murphy" <emurphy42@socal.rr.com> wrote in message
news:460c63e2$0$24701$4c368faf@roadrunner.com...
>
> I think SQL Server 2005 has a built-in pivoting function, but I've
> never used it so I don't know the syntax.

Here is how it can be done with PIVOT in SQL Server 2005:

SELECT [Product A],
[Product B],
[Product C]
FROM Products
PIVOT (SUM(RankID) FOR [Name] IN ([Product A],
[Product B],
[Product C])) AS P

I find the PIVOT syntax to be not so intuitive (unlike UNPIVOT which is
easier to use and understand).

Plamen Ratchev
http://www.SQLStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация