SQLite version 3.7.3 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t(d date); sqlite> insert into t values('2010-06-01'); sqlite> insert into t values('2010-08-01'); sqlite> insert into t values('2010-09-01'); sqlite> insert into t values('2010-11-01'); sqlite> insert into t values('2010-12-01'); sqlite> insert into t values('2011-01-01'); sqlite> insert into t values('2011-02-01'); sqlite> select * from t; 2010-06-01 2010-08-01 2010-09-01 2010-11-01 2010-12-01 2011-01-01 2011-02-01 sqlite> select d,date(d,'+6 months') from t; 2010-06-01|2010-12-01 2010-08-01|2011-02-01 2010-09-01|2011-03-01 2010-11-01|2011-05-01 2010-12-01|2011-06-01 2011-01-01|2011-07-01 2011-02-01|2011-08-01 You don't say what language you're working in. But you'd just grab the date field you're working and do this; select d from mytable where d <= date(mydate,'+6 months'); So I assume you'd be iterating over "mydate" in your code. Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems
________________________________ From: sqlite-users-boun...@sqlite.org on behalf of Redhot Sent: Thu 10/28/2010 1:58 PM To: sqlite-users@sqlite.org Subject: EXTERNAL:[sqlite] Dates based on fliter I would like to add the 6 months, 12 months 18 months and 24 months to a date entered into the sqlite database. The date in the database is in sql formate YYYY-MM-DD. The dates will be used for a filter. The filter will pull Rows from a table. Like the first filter would be the Date entered to Six months from the Date Entered. The Next would be Six months +1 to twelve months from the date entered. The filter is based on the enter date. If the enter date is 2010-06-01, I would like to create a filter in table that would only pull records that are in the date range of 2010-06-01 to 2010-12-01 (which is six months from the enter date. I appreicate your help in advance. -- View this message in context: http://old.nabble.com/Dates-based-on-fliter-tp30079627p30079627.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
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users