Hi, I just want to know why the following SQLite query does not work as I expected?
WITH RECURSIVE dates(dateD) AS ( VALUES('2015-10-03') UNION ALL SELECT date(dateD, '+1 year') FROM dates WHERE date(dateD) <= date('2016-11-01') ) SELECT max(dateD), count(dateD) FROM dates; 2017-10-03|3 which is not what I am expecting. I am expecting the followings: 1. the query add to the date('2015-10-03') 1 year which is '2016-10-03' 2. then it compares the two dates: 2016-10-03 with 2016-10-03 3. because 2016-10-03 = 2016-10-03 it count 1 4. then add to the result date 2016-10-03 once again 1 year which is 2017-10-03 5. then it compares the two dates: 2017-10-03 with 2016-10-03 6. because 2017-10-03 > 2016-10-03 it does not count 2 7. it should gives the following result: 2016-10-03|1 What am I doing wrong here? -- Best, Pali _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users