Hi I have the following problem and am trying to solve which is the best solution.
I have a table called [Kpi] and the data will be like this: -
[ContractId] [KpiId] [NotificationIntervalInMonths]
1000 1 3
1000 2 5
I have a table [Contract] that contains: -
[ContractId] [StartDate] [EndDate]
1000 1/Nov/2009 4/Apr/2011
I am going to show a schedule of notifications about when Kpi should notify the user between the start and end dates of the contract, for example. The following columns / rows will be created in the above structure: -
[ContractId] [KpiId] [NotificationDate]
1000 1 1/Feb/2009
1000 1 1/May/2010
1000 1 1/Aug/2010
1000 1 1/Nov/2010
1000 1 1/Feb/2011
1000 2 1/Apr/2010
1000 2 1/Sep/2010
1000 2 1/Feb/2011
First of all, I thought that I was creating a lookup table that would populate every time I inserted a new Kpi, this seems doable and might seem the best.
- , [NotificationIntervalInMonths] , [EndDate] . , / [EndDate], .
, , SQL, ? : P, , CTE .
, , .