Good morning, I'm doing a query (mysql) and I have four dates periodo1inicio
, periodo1final
, periodo2inicio
and periodo2final
. I need to count how many days of period 2 is contained in period 1.
Can anyone help me with this, please?
Thank you in advance, hug.
EDIT
imagine that I have a barracao to save boats and I had a boat saved it from 01/01/2014 until 01/31/2014 and during that period the value of the daily rate changed twice, from 02/12/2013 until 15/01/2014 the daily cost X and from 01/16/2014 until 02/15/2014 the daily cost Y.
I need to know that 15 days I charge the daily X and the rest of the days I charge the Y rate.
I do not know if the example helps or disrupts.