I am trying to insert rows in a table with certain conditions -
There is a table with fields - ID, month, year, and value. The logic that I need to implement is if for an ID there is no row for a specific month and year then I want to insert that row into this table.
ID Month Year Value
1 01 2016 2
1 02 2016 10
2 11 2015 15
2 12 2015 5
2 09 2015 8
Now, in this example, since for ID=1 Month/ Year 03/2016 is missing so in this case I would like to insert
1 03 2016 0
Similarly, Oct 2015 is missing so it wil be like
2 10 2015 0
I am not able to figure it out myself, can someone help me with this! Any help will be really appreciated!
Thanks,
Priyanka