Lets say I have a column named 'time' that stores timestamps as juliandays.
Suppose I only want to extract rows for the past 2 hours from now, I could
do:

select datetime(time) from table where time >= julianday('now','-2
hour','localtime') order by time desc

That works as expected. However what if I want to go 2 hours backwards from
a *specific* julianday value? say, 2 hours from the most recent datetime
value recorded in the table. This gets me the latest timestamped record:

select datetime(max(time)) from table

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

I am sure I am missing something here. Any suggestions?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to