Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Column SUM when using UNION

user6185307Jan 5 2012
Hi,
I need to create a simple line chart reports based on the following

book_date
arrival_date
lead_day (book_date-arrival_date)
count

which shows in how many lead_days in percentage I have with value=5 and how many with value=10

I need to know how many lead_day=5 I have in one year and how many lead_day=10.
So far, so good

SELECT saw_0, saw_1 FROM ((SELECT COUNT(TIMESTAMPDIFF(sql_tsi_day, Stays."Book Date", Stays."Arrival Date")) saw_0, '5 lead days' saw_1 FROM STAY WHERE (TIMESTAMPDIFF(sql_tsi_day, Stays."Book Date", Stays."Arrival Date") = 5) AND (Resort.Resort = 'AGHEMB')) UNION (SELECT COUNT(TIMESTAMPDIFF(sql_tsi_day, Stays."Book Date", Stays."Arrival Date")) saw_0, '10 lead days' saw_1 FROM STAY WHERE (TIMESTAMPDIFF(sql_tsi_day, Stays."Book Date", Stays."Arrival Date") = 10) AND (Resort.Resort = 'AGHEMB'))) t1 ORDER BY saw_1

I can also get how much this is in percentage by using the pivot table.
The problem is that I need a line chart showing in orizzontal the lead days and in vertical the percentage.
I guess I need to work with a table and have there a column that show the percentage as result of ( (row *100)/TOTAL).
In a normal report without a UNION is very simple, but I do not get it to work while using UNION.

Did I made the point?
Thanks and Regards
G.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details