 <pre><code>select t.name, CASE rows.col_name WHEN 'Math' THEN t.Math WHEN 'English' THEN t.**math** WHEN 'Arts' THEN t.Arts end as Grade from the_table t, (select 'Math' as col_name union all select 'English' as col_name union all select 'Arts' as col_name) rows </code></pre>