Skip to main content

Timeline for get all dates in the current month

Current License: CC BY-SA 3.0

10 events
when toggle format what by license comment
Apr 23, 2015 at 1:02 vote accept indago
S Apr 15, 2015 at 7:24 history edited ypercubeᵀᴹ CC BY-SA 3.0
the query had an error maybe a typo you missed from `DATEDIFF(cal.end_date, cal.start_date)` to `DATEDIFF(s.end_date, s.start_date)`
S Apr 15, 2015 at 7:24 history suggested indago CC BY-SA 3.0
the query had an error maybe a typo you missed from `DATEDIFF(cal.end_date, cal.start_date)` to `DATEDIFF(s.end_date, s.start_date)`
Apr 15, 2015 at 6:19 comment added indago Your solution works perfect, no hitches at all, quite simple and fast! But i need to compare it with @Ronalo's compact solution and use huge data to clearly benchmark the best solution. I have tested it on a table with only 4230 rows, i want to use a table with more than 500,000 records to have a clear picture. So far your solution is the best! thumbs up!
Apr 15, 2015 at 5:56 review Suggested edits
S Apr 15, 2015 at 7:24
Apr 14, 2015 at 10:00 comment added indago i think that was my problem creating the table inside the stored proc. let me redo it then let you know
Apr 14, 2015 at 9:51 comment added ypercubeᵀᴹ If the days table is fixed and has 31 rows, why would there be a problem (even if a million queries use it)? It (the days table as in the answer) should be created once and not every time, by every run of a stored procedure.
Apr 14, 2015 at 9:48 comment added indago Thanks alot for your quick answer, i had to wrap this up in a stored procedure and i used SELECT DAY(LAST_DAY(CURDATE())) last_d; to get the current month's total days to populate the days table in a loop. But i immediately bumped into a problem, when two concurrent users are accessing the system and working on different months
Apr 14, 2015 at 9:35 history edited ypercubeᵀᴹ CC BY-SA 3.0
added 265 characters in body
Apr 14, 2015 at 9:19 history answered ypercubeᵀᴹ CC BY-SA 3.0