Hi,
I have done little changes in your query by adding join between both the tables:
insert into [Global_Report_Staging].[dbo].[RPT_Invoice_Shipped]
(Day_No, Date, Div_code, Total_Invoiced, Transaction_Date)
select cal_data.month_no,CONVERT(DATE,Getdate()) as Date, LTRIM(RTRIM(div_Code)),
sum(tot_Net_Amt) as Total_Invoiced, (dateadd(day, -1, convert(date, getdate())))
from [Global_Report_Staging].[dbo].[STG_Shipped_Invoiced] SSI
Inner join cal_data ON datepart(mm, SSI.Transaction_Date) = cal_data.month_no
WHERE CONVERT(DATE,Created_date )=CONVERT(DATE,Getdate())
group by div_code
Now you can use any of the column from both of the table. Will it work for you ?
Please let me know if you have any concern or query or I am missing something.
Thanks
Advay Pandya