Posted by Ed Murphy on 03/30/07 01:11
Plamen Ratchev wrote:
> SELECT SUM(CASE WHEN [Name] = 'Product A' THEN RankID ELSE 0 END) AS
> 'Product A',
> SUM(CASE WHEN [Name] = 'Product B' THEN RankID ELSE 0 END) AS
> 'Product B',
> SUM(CASE WHEN [Name] = 'Product C' THEN RankID ELSE 0 END) AS
> 'Product C'
> FROM PRODUCTS
I think SQL Server 2005 has a built-in pivoting function, but I've
never used it so I don't know the syntax.
Navigation:
[Reply to this message]
|