我查询了一个放置应用程序跟踪系统,该系统显示了每个学习课程的学生放置和未放置的数量。即使查询返回了所需的结果,我仍在努力创建一个APEX Stacked Bar Chart。
查询:
SELECT programme_name,
SUM(CASE WHEN (cv_approval_date IS NOT NULL AND application_status_id <> 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 <> 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;
输出:
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
该图应该看起来与此类似 - x轴为Program,y轴为放置的学生数,未放置:
http://ruepprich.files.wordpress.com/2011/03/stacked_bar.png?w=550&h=386
我该怎么做呢?任何帮助将不胜感激!
答案 0 :(得分:2)
在Apex中创建图表时,您可以点击&#34; 图表查询示例&#34;对于一些可以使用该图表类型的示例查询。
对于堆积条形图,给出以下示例:
SELECT NULL LINK,
ENAME LABEL,
SAL "Salary",
COMM "Commission"
FROM EMP
ORDER BY ENAME
在您的情况下,我认为您希望您的查询提供以下格式:
SELECT NULL LINK,
programme_name AS LABEL,
SUM(...) AS "Unplaced",
SUM(...) AS "Placed"
FROM ...