How to generate all dates between two dates

This is not possible without a recursive common table expression, which was introduced in SQLite 3.8.3:

WITH RECURSIVE dates(date) AS (
  VALUES('2015-10-03')
  UNION ALL
  SELECT date(date, '+1 day')
  FROM dates
  WHERE date < '2015-11-01'
)
SELECT date FROM dates;

Leave a Comment