I have the following table like this
code item price start date end date
--------------------------------------------------
art1 2.47 01/01/2015 31/03/2015
art1 1.23 01/04/2015 21/09/2015
art1 3.55 22/09/2015 01/01/2018
When I will add a new line which start date exists already between a start date and end date in the table .
I need to update the end date in the table with the start date -1 of the new line to be added
then insert the new line .
For example, I have a new line to added :
code item price start date end date
-----------------------------------------
art1 4 28/12/2015 31/05/2018
What I expect as a final result is the following table :
code item price start date end date
--------------------------------------------------
art1 2.47 01/01/2015 31/03/2015
art1 1.23 01/04/2015 21/09/2015
art1 3.55 22/09/2015 27/12/2015
art1 4 28/12/2015 31/05/2018
code item price start date end date
--------------------------------------------------
art1 2.47 01/01/2015 31/03/2015
art1 1.23 01/04/2015 21/09/2015
art1 3.55 22/09/2015 01/01/2018
When I will add a new line which start date exists already between a start date and end date in the table .
I need to update the end date in the table with the start date -1 of the new line to be added
then insert the new line .
For example, I have a new line to added :
code item price start date end date
-----------------------------------------
art1 4 28/12/2015 31/05/2018
What I expect as a final result is the following table :
code item price start date end date
--------------------------------------------------
art1 2.47 01/01/2015 31/03/2015
art1 1.23 01/04/2015 21/09/2015
art1 3.55 22/09/2015 27/12/2015
art1 4 28/12/2015 31/05/2018