Personal I need to calculate the monthly consumption of licenses used here in the company I work with.
I have a table with the product (dbo.Product) , the number of licenses installed on the server (dbo.License) the date the product was installed < (dbo.FirstDate) and the uninstall date , when the product is still installed the uninstall date is NULL.
Sample table available in sqlfiddle
I would like to know how to add license consumption by grouping by month and by product in the last 12 months.
Ex:
Date | Product | TotalLicense
2017-08 | Adobe Photoshop | 8
2017-08 | CorelDRAW | 5
2017-09 | ...
2018-07 | Adobe Photoshop | 4
2018-07 | CorelDRAW | 2
Sample table available in sqlfiddle