I have this table view
UserName Product NumberPurchaces
-------- ------- ---------------
\'John Doe\' \'Chair\' 4
\'John Doe\' \'
Oracle 11g is the first to support PIVOT/UNPIVOT, so you have to use:
SELECT t.username,
MAX(CASE WHEN t.product = 'Chair' THEN t.numberpurchases ELSE NULL END) AS chair,
MAX(CASE WHEN t.product = 'Table' THEN t.numberpurchases ELSE NULL END) AS tbl,
MAX(CASE WHEN t.product = 'Bed' THEN t.numberpurchases ELSE NULL END) AS bed
FROM TABLE t
GROUP BY t.username
You could use DECODE, but CASE has been supported since 9i.