select mfghier.MFG_ORG_CD
, timehier.CLNDR_CD
, mfghier.MFG_ITEM_CLASS_ID
, timehier.DAY_CD
, count(*) as NUM_MFG_SKU_ITEMS
from ddr_r_mfg_item_sku_dn_mv mfghier
, ddr_r_base_day_dn_mv timehier
where timehier.mfg_org_cd = mfghier.mfg_org_cd
and timehier.clndr_cd = CONCAT(mfghier.mfg_org_cd, '-BSNS')
and timehier.clndr_dt between mfghier.eff_from_dt and mfghier.eff_to_dt
group by mfghier.MFG_ORG_CD
, timehier.CLNDR_CD
, mfghier.MFG_ITEM_CLASS_ID
, timehier.DAY_CD