-- an Entrance example, http://dbentrance.com/ PLOT STACKEDBARCHART AXISLABELS, LIGHT BLUE BARS,LIGHT GREEN BARS, LIGHT RED BARS WITH TITLE "Test Scores" TITLE "Test Administered 4-25-07" TITLE "Epsilon Elementary School" TITLE "" TITLE Y "Count" TITLE X "Scores" LEGEND BOTTOM SELECT score, (select count(id) from testtemp where English = score) as 'English Scores' , (select count(id) from testtemp where Video = score) as 'Video Game Scores' , (select count(id) from testtemp where Math = score) as 'Math Scores' FROM ref_scores GROUP BY score ORDER BY score;