title: Modifying SELECT query to create Stacked Bar Chart
body: <p>I have a query for a Placement Application Tracking System which shows the number of students placed and unplaced per programme of study. I'm struggling to create an APEX Stacked Bar Chart out of it, even though the query returns the desired results. </p>
  
  <p>Query:</p>
  
  <pre><code> SELECT programme_name,
             SUM(CASE WHEN (cv_approval_date IS NOT NULL AND application_status_id &lt;&gt; 7) OR
                           application_status_id  IS NULL
                      THEN 1 ELSE 0 END) as Unplaced,
             SUM(CASE WHEN (cv_approval_date IS NOT NULL AND application_status_id &lt;&gt; 7) OR
                           application_status_id  IS NULL
                      THEN 0 ELSE 1 END) as Placed
      FROM programme LEFT JOIN
           student USING (programme_id) LEFT JOIN
           application USING (student_id)
      GROUP BY programme_name;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>    PROGRAMME_NAME                                | PLACED   | UNPLACED
      BSc (Hons) Computer Science                   | 2        | 2 
      BSc (Hons) Computing and Games Development    | 1        | 0 
      BSc (Hons) Web Applications Development       | 0        | 1 
      BSc (Hons) Marine Biology and Coastal Ecology | 1        | 0
  </code></pre>
  
  <p>The graph is supposed to look similar to this - the x axis being Programme, y axis being number of students placed, and unplaced:</p>
  
  <p><a href="http://ruepprich.files.wordpress.com/2011/03/stacked_bar.png?w=550&amp;h=386" rel="nofollow">http://ruepprich.files.wordpress.com/2011/03/stacked_bar.png?w=550&amp;h=386</a></p>
  
  <p>How might I go about doing this? Any help would be greatly appreciated!</p>