Re: [sqlite] select with date

2013-09-12 Thread jwzumwalt
Sorry for the double post :(

Thanks for your explanation. The other folks where kind enough to provide
good working examples but I did not know what logical error I had made.
Thanks again.



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/select-with-date-tp71216p71231.html
Sent from the SQLite mailing list archive at Nabble.com.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] select with date

2013-09-12 Thread Igor Tandetnik

On 9/12/2013 1:38 AM, jwzumwalt wrote:

I have not used the date function in select statements before.
I have valid entries for the current month, what am I doing wrong?

SELECT * FROM "entry" WHERE
 bankdate > date('now','end of month','-1 month')
 AND bankdate < date('now','start of month','+1 month')


'start of month' is a valid modifier, but 'end of month' is not - it's 
just an exercise in wishful thinking. See 
http://sqlite.org/lang_datefunc.html . Make it


bankdate > date('now','start of month','-1 day')
-- or
bankdate >= date('now','start of month')

--
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] select with date

2013-09-12 Thread Clemens Ladisch
jwzumwalt wrote:
> I have valid entries for the current month, what am I doing wrong?
>
> SELECT * FROM "entry" WHERE
> bankdate > date('now','end of month','-1 month')
> AND bankdate < date('now','start of month','+1 month')

What you are doing wrong is that you have not made valid entries for the
current month.  The string format for such dates must be -mm-dd.


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users