I have a view which pulls back 46,712 records which include the following 2 fields:
StartDate &
EndDate
I need to add a new column to be called ‘Period’, in this column I need to have each record listed as either ‘Cumulative’ or ‘Non Cumulative’
The problem with this is that firstly all of my records need to have a ‘Cumulative’ row, and every record that is active in the current month must also have a ‘Non-Cumulative’ row.
The rules that apply for a record to qualify to be classed as Non-Cumulative are the following:
EndDate = NULL
EndDate within the current month
As all my rows no matter what the criteria must have a ‘Cumulative’ row, I must therfore duplicate any rows which qualify for the ‘Non-Cumulative’ type using some sort of JOIN.
So if i have 46712 rows and 200 of these are ‘Non-Cumulative’ I should end up with 46,812 rows. (200 being duplicate apart from the Cumulative/Non Cumulative result.
Does anyone have any suggestions of how I should go about doing this.
If I understand the question then this should do what you need.