enter image description hereI have two tables that I need to join together and i'm possibly overthinking the issue.
Baseline table has a entry for each month. In the actual table most applications have 12 monthly values, but there are app id's that do not have activity for all twelve periods. When I join on the appid & date, i'm not returning 12 records.
Ideal scenario is a record by app id for each month with the baseline value and the actual volume. When there is no actual volume, return a null or zero.
Baseline Table:
select year(bl_date) as yearno, month(bl_date) as monthno, bl_app_id, bl_monthly_value from itins_dl.dm_baseline_mapping_tmp where bl_app_id = 'APP000020009174' order by bl_date asc;
Actuals Table:
select year(clse_dttm) as yearno, month(clse_dttm) as monthno, appl_unique_id, count(number) as tickets from datamart_core.dm_appmaintenance_actuals where year(clse_dttm) = 2025 and appl_unique_id = 'APP000020009174' group by year(clse_dttm), month(clse_dttm), appl_unique_id order by month(clse_dttm);