"P Kishor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Given a table t (name, date) > > I want to find all rows within, say, 6 months of a specific row, say > name = 'foo'. So, I am doing > > SELECT name > FROM t > WHERE > (SELECT julianday(date) FROM t WHERE name = 'foo') - > julianday(date) < 180 OR > julianday(date) - (SELECT julianday(date) FROM t WHERE name = > 'foo') < 180
select t1.name from t t1, t t2 where t2.name='foo' and julianday(t1.date) - julianday(t2.date) between -180 and 180; Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users