Skip to Main Content

SQL Developer

Query returning empty months

Javier PMar 10 2022

Hi all,

I have this query that returns the production of the last 12 months.
This is the query:

select
    null
  , sum(f.comision)         value
  , trunc(f.efectiva, 'MM') label
from
    risk_facturas f
where
    f.efectiva >= add_months(trunc(sysdate), -13) and f.efectiva < trunc(sysdate) + 1
and f.organizacion_id = :APP_GET_ORGANIZACION_ID
group by
    trunc(f.efectiva, 'MM')

How can I get a line for every month no matter if it has any production or is just 0? Can this be done?
Thanks for the help!
Javier

This post has been answered by Solomon Yakobson on Mar 12 2022
Jump to Answer
Comments
Post Details
Added on Mar 10 2022
18 comments
54 views