Developers,
anyone knows how to build stacked bar chart queries ?
As far as I can understand I need to use a sub query after the FROM, the only example I could find is the following but has no explanation ( they just say, wrote this query and you will get the following )
SELECT NULL link,
sales_month value,
revenue "Hardware"
FROM (
SELECT TO_CHAR(o.order_date,'Mon YY') sales_month,
SUM(oi.quantity * oi.unit_price) revenue,
TO_DATE(to_char(o.order_date,'Mon YY'),'Mon YY') sales_month_order
FROM OEHR_PRODUCT_INFORMATION p,
OEHR_ORDER_ITEMS oi,
OEHR_ORDERS o,
OEHR_CATEGORIES_TAB ct
WHERE o.order_date <= (trunc(sysdate,'MON')-1)
AND o.order_date > (trunc(sysdate-365,'MON'))
AND o.order_id = oi.order_id
AND oi.product_id = p.product_id
AND p.category_id = ct.category_id
AND ct.category_name like '%hardware%'
GROUP BY TO_CHAR(o.order_date,'Mon YY')
ORDER BY sales_month_order
)
Now, form the above I can see that the inner query is creating a virtual table with the following columns:
sales_month, revenue, sales_month_order
then the outer query is selecting sales_month and revenue, how ever if i try the same it doesn't work
I would need to have a stacked bars chart that shows for each bar the max score and inside each bar the score by area of different cases/tickets
I built the following query:
select null link, sr value, Score from(select c.sr, sum(sc.value) Score from cases c join qa q on(c.case_id=q.case_id) join scores sc on(q.score_id=sc.score_id) join skills s on(q.skill_id=s.skill_id) join areas a on(s.area_id=a.area_id) group by c.sr)
This works but does not split the bars in segments for the different areas, not sure why
Any help appreciated
Thank you !
