 <p>If you are using 11g or later try</p> <pre><code>select * from table1 PIVOT (SUM("COUNT") FOR ("LOCATION","CATEGORY") IN (('BLDG A',1) AS sum_a1, ('BLDG A',2) AS sum_a2, ('BLDG A',3) AS sum_a3, ('BLDG B',1) AS sum_b1, ('BLDG B',2) AS sum_b2, ('BLDG B',3) AS sum_b3)); </code></pre> <p><a href="http://www.sqlfiddle.com/#!4/a1905/18" rel="nofollow">Here</a> is a fiddle</p> <p>Otherwise use <a href="http://stackoverflow.com/a/13082852/1083652">APC's solution</a></p>