I have a table in MySQL with records that contain a start_date
and an end_date
. I'd like to know how many occurrences of the 1st day and the 15th day of the month exist within the period between those two dates.
ie., if start_date
is 2021-07-28 and end_date
is 2021-10-21 the result should be 6, because all of these dates are included in the period:
2021-08-01
2021-08-15
2021-09-01
2021-09-15
2021-10-01
2021-10-15
Any idea how I could achieve this? Thanks