Relating to the creation of a graph, get an error with a statement "Union All".

Hello

I have some data in the table with the following fields;

Product, Jul-08 Aug-08, Sep - 08 etc. to Jan - 10.

The PRODUCT field is text showing many product names

The month of Jul-08 & others have numbers by product that must be aggregated for this month & plotted on the graph of the line.

My SQL to create the first point on the chart is as below;

Select the link null, label, SUM(JUL-08) "FFF".
of "SCHEMANAME." "' TABLENAME '.
WHERE PRODUCT = "FFF".
PRODUCT GROUP
ORDER BY PRODUCT

It works fine until I want to add the second point of this graphic line by using a "union all" join as follows:

Select the link null, label, SUM (JUL_08) "FFF".
of "SCHEMANAME." "' TABLENAME '.
WHERE PRODUCT = "FFF".

UNION ALL

Select the link null, label, SUM (AUG_08) "FFF".
of "SCHEMANAME." "' TABLENAME '.
WHERE PRODUCT = "FFF".

I can't work on how I can join the other months on the line graph of a series.

The error is as follows;

--------------------------------------

1 error has occurred
Failed to parse the SQL query:
Click link null, label, SUM (OCT_09) 'Non-communicable diseases - STD' of 'BI_A_DATA '. "" CDW_VS_NCDS_CALLS "WHERE PRODUCT ="MNT - STD' UNION ALL select link null, PRODUCT, SUM (NOV_09) "Non-communicable diseases - LOCAL" label of "BI_A_DATA". "" CDW_VS_NCDS_CALLS "WHERE PRODUCT ="MNT - LOCAL.

ORA-00937: not a single group group function

Some queries can be run when you run your application, if your query is syntactically correct, you can save your query without validation (see options below the source of the query).

----------------------------------------

If anyone can help?

I want a continuous linear graph showing monthly July 2008, Aug-08 Sep - 08 etc. to Jan - 10 for the same product.

I will then add other series for other products, thanks

OK a graphic line will only allow you to draw 1 variable (in this case period). Given that it is only for a single product, so here should be the final sql:

SELECT null link, PERIOD label, SUM(ABC)
FROM
(SELECT 'JUL_08' PERIOD,SUM(JUL_08)ABC
FROM BI_A_DATA.APEX_TEST
WHERE PRODUCT = 'ABC'

UNION ALL

SELECT 'AUG_08' PERIOD,SUM(AUG_08)ABC
FROM BI_A_DATA.APEX_TEST
WHERE PRODUCT = 'ABC'

UNION ALL

SELECT 'SEP_08' PERIOD,SUM(SEP_08)ABC
FROM BI_A_DATA.APEX_TEST
WHERE PRODUCT = 'ABC')

GROUP BY PERIOD

Tags: Database

Similar Questions

Maybe you are looking for