
Originally Posted by
tomalex0
Trying to figure out how it works

.
meanwhile, you could also just create a numbers table that is large enough to cover the largest date range that you want to handle...
Code:
CREATE TABLE numbers ( n INTEGER NOT NULL PRIMARY KEY );
INSERT INTO numbers VALUES
(0),(1),(2),(3),(4),(5),(6),(7),(8),(9),...
then that query simplifies to --
Code:
SELECT DATE('2011-02-01') -- start date
+ INTERVAL n DAY AS thedate
from numbers
WHERE DATE('2011-02-01') + INTERVAL n DAY
< DATE('2011-03-01') -- end date plus one
Bookmarks