strftime('%d', ...) returns you day of month. So you're subtracting two days of month disregarding the month they belong. So what are you expecting to achieve in this way? Maybe you need to use '%J' instead of '%d'? http://www.sqlite.org/lang_datefunc.html
Pavel On Fri, Nov 20, 2009 at 11:15 AM, <g.costa...@email.it> wrote: > Hi,why? > > > SELECT ProductID,OrderDate ,DispatchDate, > strftime('%d',tblOrders.DispatchDate) - strftime('%d',tblOrders.OrderDate) > > FROM tblOrders > > WHERE ProductID = 2195 > > AND OrderState IN (0,10) > > > returns > > > 1,(2195, u'2008-09-02', u'2008-09-12', 10) > > 2,(2195, u'2008-09-17', u'2008-09-29', 12) > > 3,(2195, u'2008-10-27', u'2008-11-12', -15) > > 4,(2195, u'2008-12-17', u'2008-12-24', 7) > > 5,(2195, u'2009-01-19', u'2009-02-04', -15) > > 6,(2195, u'2009-06-08', u'2009-06-12', 4) > > 7,(2195, u'2009-09-28', u'2009-10-02', -26) > > > look at 3,5 and 7 row > > in 3 instead of 16 days it return -15 > > in 5 return -15 instead of 16 > > in 7 -26 instead of 4 > > it seems that when a date interval > > is between two months the function fails. > > > any suggestion? > > > -- > > Giuseppe > > Non mi chiedermi di coniugarti i verbi > > non li so > > "se li avrei saputi mo' te l'imparavo" > > > > -- > Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP > autenticato? GRATIS solo con Email.it: http://www.email.it/f > > Sponsor: > Gioca anche tu alla "faccia degli amici", crea la faccia che preferisci e > vinci fantastici premi! Gioca ora > Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=9868&d=20091120 > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users