listar dinamicamente fecha usando recursividad en mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with recursive | |
p as ( | |
select cast(:fecha_desde as date) fecha_desde , | |
cast(:fecha_hasta as date) fecha_hasta | |
), | |
fechas as ( | |
select cast(p.fecha_desde as date) fecha | |
from p | |
union | |
select date_add(f.fecha, interval 1 day) | |
from fechas f, p | |
where fecha < p.fecha_hasta | |
) | |
select * | |
from fechas; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment