<p>I have a select query that currently produces the following results:
<BR></p>

<pre><code>Description   Code    Price
 Product 1     A        5
 Product 1     B        4
 Product 1     C        2
</code></pre>

<p>Using the following query:  </p>

<pre><code>SELECT DISTINCT np.Description, p.promotionalCode, p.Price
FROM            Price AS p INNER JOIN
                         nProduct AS np ON p.nProduct = np.Id
</code></pre>

<p>I want to produce the following:   </p>

<pre><code>Description  A  B  C
 Product 1   5  4  2
</code></pre>

```
```
SELECT 
    np.Id, 
    np.Description, 
    MIN(Case promotionalCode WHEN 'A' THEN Price ELSE NULL END) AS 'A',
    MIN(Case promotionalCode WHEN 'B' THEN Price ELSE NULL END) AS 'B',
    MIN(Case promotionalCode WHEN 'C' THEN Price ELSE NULL END) AS 'C'
FROM 
    Price AS p 
INNER JOIN nProduct AS np ON p.nProduct = np.Id
GROUP BY 
    np.Id,
    np.Description
```
```
Here is a simple test example:
```
```
DECLARE @temp TABLE (
    id INT,
    description varchar(50),
    promotionalCode char(1),
    Price smallmoney
)

INSERT INTO @temp
select 1, 'Product 1', 'A', 5
    union
SELECT 1, 'Product 1',  'B', 4
    union
SELECT 1, 'Product 1', 'C', 2

SELECT
    id,
    description,
    MIN(Case promotionalCode WHEN 'A' THEN Price ELSE NULL END) AS 'A',
    MIN(Case promotionalCode WHEN 'B' THEN Price ELSE NULL END) AS 'B',
    MIN(Case promotionalCode WHEN 'C' THEN Price ELSE NULL END) AS 'C'
FROM
     @temp
GROUP BY 
    id,
    description
```
```