Skip to Main Content

APEX

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!

Problem with SQL query to get Missing Months

machepalliSep 29 2016 — edited Sep 29 2016

Hi,

This is bala, I am using Apex 5.0

I am facing one sql query problem to get the missing months and data

my table name called PLAN

DATE_UPDATED         PROJECT_ID

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

jan-16                               11134

Feb-16                              56545

june-16                             411134

Sep-16                             52 111

I have created Line chart using sql query like below

select

       NULL as link,

       TO_CHAR(TRUNC(DATE_UPDATED, 'MM'), 'MON-YY') month,

       sum(count(PROJECT_ID)) over (order by trunc(DATE_UPDATED, 'MM')) AS "Actual Progress" 

    from Plan

group by trunc(DATE_UPDATED, 'MM')

Expected Result

____________

DATE_UPDATED   PROJECT_ID

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

jan-16                               1

Feb-16                              2

Mar-16                               2

Apr-16                             2

May-16                             2

june-16                             3

july-16                             3

Aug-16                             3

Sep-16                             4

here Line chart is generated but some of the months missing in my database.  So I need missing months along with previous month data

For Example: Mar-2016 missing in my data base. Then I need Feb-2016 month data.

So I have created page in Oracle.apex.com with below credentials.

See--->https://apex.oracle.com/pls/apex/f?p=4550:1:109824234806410:::::

workspace: PMT

User: machepalli@gmail.com

Pass: bala

Created page

_____________

Page No 51.

https://apex.oracle.com/pls/apex/f?p=62945:51:116621859537095:::::

Note: I know the problem with sql query. I have tried but no luck. So kindly help me here

Regards,

Bala

This post has been answered by Alex Nuijten on Sep 29 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2016
Added on Sep 29 2016
8 comments
827 views