> To delete all rows with dates earlier than 1/1/2005 I used the statement: > > DELETE FROM Penalties WHERE DateIssued < '1/1/2005'; > > but it did not delete the records. Doesn't matter if I use single quotes, > double quotes, or no quotes.
Just a note: when you tried it without quotes you tried to delete rows with DateIssued less than 1/2005 = 0.000498... And the main problem: SQLite doesn't have such type as date. All types it supports are listed here: http://www.sqlite.org/datatype3.html. Your dates are compared as simple strings. Thus with your statement you're trying to delete all rows where DateIssued is January, 1 of any year earlier than 2005. Bottom line: change the way you store your dates if you really want to compare them in sql statements. Pavel On Thu, Oct 8, 2009 at 4:06 PM, Rich Shepard <[email protected]> wrote: > This must be my error, but I am not seeing it. Your input is requested. > > I have a table named Penalties with a column named DateIssued and a > datatype of DATE. A select operation shows dates such as 4/6/1992 and > 12/15/1993. > > To delete all rows with dates earlier than 1/1/2005 I used the statement: > > DELETE FROM Penalties WHERE DateIssued < '1/1/2005'; > > but it did not delete the records. Doesn't matter if I use single quotes, > double quotes, or no quotes. > > Trying to figure out where my syntax is faulty I tried selecting those > records, but none are presented. I'm sure it's a simple user error in my > syntax, but I don't see what that error is and I don't find anything in Rick > van der Lans's or Mike Owen's books that's different from what I've tried. > > I'm sure it's a head-slapping, obvious error so please point it out to me. > > Thanks, > > Rich > > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

