Re: pivot table without aggregation?
- From: Ed Murphy <emurphy42@xxxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 18:11:53 -0700
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.
.
- Follow-Ups:
- Re: pivot table without aggregation?
- From: Plamen Ratchev
- Re: pivot table without aggregation?
- References:
- pivot table without aggregation?
- From: Mike
- Re: pivot table without aggregation?
- From: Plamen Ratchev
- pivot table without aggregation?
- Prev by Date: Re: Update Status Field after Expiry Date
- Next by Date: Re: pivot table without aggregation?
- Previous by thread: Re: pivot table without aggregation?
- Next by thread: Re: pivot table without aggregation?
- Index(es):