>I need to find out how many specific weekdays (e.g., how many Sundays) 
>I have in any given range of dates.
>My problem: How to use the COUNT function in combination with the 
>strftime() function.
>
>$ sqlite3 test.db3
>SQLite version 3.6.20
>sqlite> create table test (date VARCHAR(20), money INTEGER);
>sqlite> INSERT INTO "test" VALUES('2007-07-20', 1000);
>sqlite> INSERT INTO "test" VALUES('2007-07-21', 2100);
>sqlite> INSERT INTO "test" VALUES('2007-07-22', 2200);

That will do:
select count(*) from test where date between '2007-07-20' and 
'2007-07-22' and strftime('%w', date) = '0';

This will select and count, not compute anything.

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

Reply via email to