Good Afternoon,
I had an interesting question that I wanted to put the the stack overflow community. We have a data set in our data warehouse (SQL Server) with unique identifier and several months for that unique identifier. For example if one looked at it in Dec 2018 and saw these rows below:
Row ID BeginDate EndDate Unique ID Amount
178484 2018-01-01 2018-01-31 GroupID1 387.22
176555 2018-03-01 2018-03-31 GroupID1 751.07
170120 2018-04-01 2018-04-30 GroupID1 567.48
172037 2018-09-01 2018-09-30 GroupID1 587.51
179024 2018-10-01 2018-10-31 GroupID1 63.42
182061 2018-11-01 2018-11-30 GroupID1 728.04
What we would love is somehow to identify missing rows (months) that are missing. For example for the above, we would insert the following rows
- Feb, May, Jun, Jul, Aug, and Dec The Final month that would be entered could be the date that the query is run.
It is important to note that obviously this is not the only row grouping in our database. Furthermore, we would to avoid cursors. We have tried doing this with a cursor and a temp table that holds all the valid values. But was hoping that there is a faster way to approach this.
Any help would really be appreciated on this.
All the best, George Eivaz