I'd like to write a query that generates ten consecutive days starting at
"2011-02-05" (for example), but I believe I'm having trouble with quoting. 
Assume I have a table of ten digits such as:

CREATE TABLE "digits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"digit" integer) 
INSERT INTO "digits" ("digit") VALUES (0)
INSERT INTO "digits" ("digit") VALUES (1)
INSERT INTO "digits" ("digit") VALUES (2)
INSERT INTO "digits" ("digit") VALUES (3)
INSERT INTO "digits" ("digit") VALUES (4)
INSERT INTO "digits" ("digit") VALUES (5)
INSERT INTO "digits" ("digit") VALUES (6)
INSERT INTO "digits" ("digit") VALUES (7)
INSERT INTO "digits" ("digit") VALUES (8)
INSERT INTO "digits" ("digit") VALUES (9)

A query that does NOT work is:

sqlite> SELECT DATE("2011-02-05 21:42:20", "units.digit DAY") AS d FROM
digits AS units;








... which returns ten blank records.  Using units.digit as the sole argument
shows that the counting is working:

sqlite> SELECT DATE(units.digit) AS d FROM digits AS units;
-4713-11-24
-4713-11-25
-4713-11-26
-4713-11-27
-4713-11-28
-4713-11-29
-4713-11-30
-4713-12-01
-4713-12-02
-4713-12-03

... but of course I'd like something more current.  Is there some obvious
quoting that I'm missing?

Thanks in advance.

- ff

PS: I know you can do this with stored functions, but this is a small
snippet of a larger system in which a stored function isn't appropriate.
-- 
View this message in context: 
http://old.nabble.com/generating-mini-calendar%3A-DATE-and-quoting...-tp30896927p30896927.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

Reply via email to