On Mon, Oct 24, 2011 at 11:47 AM, Doug Currie <doug.cur...@gmail.com> wrote:

>
> On Oct 24, 2011, at 11:07 AM, Dilip Ranganathan wrote:
>
> > But as you all know, this doesn't work:
> >
> > select datetime(time) from table where time >=
> > julianday(datetime(max(time)),'-2 hour','localtime') order by time desc
>
> Try replacing datetime(max(time)) with (select datetime(max(time)) from
> table)
>
> as in
>
> sqlite> select datetime(time) from table
>   ...> where time >=
>   ...> julianday((select datetime(max(time)) from t),'-2 hour','localtime')
> order by time desc;
> 2011-10-24 15:43:45
> 2011-10-24 15:43:39
> sqlite>
>
>
That worked like a charm. Thanks! I should've just tried this but somehow
the idea of a query going inside a sqlite function didn't seem all that
obvious to me.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to