I would like to know if there is any way to fill in missing dates through a query.
I have a query that groups by CIC of clients, from the most current to the oldest
IF OBJECT_ID('tempdb..#tblsaldo2') is not null drop table #tblsaldo2 SELECT ROW_NUMBER() OVER (PARTITION BY CIC ORDER BY fecha desc) AS row_num, CIC, CONVERT(date,CONCAT(fecha, '01')) as fecha, saldo INTO #tblsaldo2 FROM #tblsaldo
which basically gives me this output:
As seen in these groupings, the months are not sequential, because the corresponding month does not exist. I would like to know if there is any way to fill in the missing months in the rows with the same grouping data and the “saldo” column with a value 0 as in the following screenshot