I have a table that contains: Id, Name, Startdate, Enddate. I would like to Find All Sunday dates between Startdate and Enddate.
Table Mysqli
ID | Name | Startdate | enddate |
---|---|---|---|
1 | robert | 01-01-2024 | 31-01-2024 |
2 | ann | 13-01-2024 | 20-01-2024 |
3 | ken | 20-01-2024 | 25-01-2024 |
4 | marco | 20-01-2024 | 30-01-2024 |
Output Result Expected to take all sundays of the persons in the date range.
Name | Sundays |
---|---|
robert | 07-01-2024 |
robert | 14-01-2024 |
robert | 21-01-2024 |
robert | 28-01-2024 |
ann | 14-01-2024 |
ken | 21-01-2024 |
marco | 21-01-2024 |
marco | 28-01-2024 |
2
Answers
Assuming you want one row per original row and a comma separated list of dates, this would be:
fiddle
output:
see: DBFIDDLE