Created
August 9, 2022 17:45
-
-
Save dario61081/b7643b0065f695d2df1fbcbc494c206d to your computer and use it in GitHub Desktop.
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