I'm trying to create a query that pulls a certain item on a certain day . and also gives me the sum of Total store Inventory on hand, Total Distrisbution Center (DC ) On hand and On Order . I'm having issues joining all the tables. any ideas?
select
d.DAY_DATE,
c.wic_nbr,
c.wic_Desc,
c.basic_prod_ind,
sum(b.lo_ioh_units) "Total Store Inventory on Hand Units",
sum(a.TOT_REG_IOH_UNITS+a.TOT_DISTR_IOH_UNITS) "Total DC Inventory on Hand Units",
sum(a.TOT_REG_ordr_UNITS+a.TOT_DISTR_ordr_UNITS) "Total DC On Order Units "
from MSS_OWNER.FCT_DA_DAY_DC_VEND_WIC a
Join fct_ioh_day_str_pln b
ON a.PROD_ID = b.PROD_ID
JOIN dim_prod_wic c
ON a.PROD_ID = c.PROD_ID
JOIN dim_period d
on a.PER_ID = d.PER_ID;
Where (a.TOT_REG_IOH_UNITS+a.TOT_DISTR_IOH_UNITS+a.TOT_REG_ordr_UNITS+a.TOT_DISTR_ordr_UNITS)>0
and (b.lo_ioh_units)> 0
and d.DAY_DATE = to_date ('01/24/2017','MM/DD/YYYY')
and b.wic_nbr in ('955612')
group by
d.DAY_DATE,
c.wic_nbr,
c.wic_desc,
c.basic_prod_ind