I have a table named output and it has 4 columns. Columns are period, index, scenario and run id.3 set of load happens.
For first load all data comes in and run id is set as 1.
Second load new data comes in and run id becomes 2
Third load for different period the load happen and period column is loaded for different period. The run id reset to 1
I need a query which check for each load. It should check if the data exist in table and if exist then it should not do anything if not exist in table it run id should increment 1. Also if the load happens for different period then the run id should reset to 1.