A table has a column of dates and times that look like this: 2015-10-02 07:55:02 2015-10-02 07:55:02 2015-10-02 10:00:03 2015-10-02 10:05:02 2015-10-02 10:10:02
Schema: CREATE TABLE general ( id integer primary key autoincrement, server text, date_time_stamp text); Would like to get the latest two dates and times, kept in ascending order, e.g. the query should return these two values: 2015-10-02 10:05:02 2015-10-02 10:10:02 Is there a way to store the number of values in the date_time_stamp column and use the count minus N to get the largest N values in the column? Query: select date_time_stamp a from general, c as count(a) from general where date_time_stamp!='date_time_stamp_isempty' order by a limit c,2; Error: incomplete SQL: select date_time_stamp a from general, c as count(a) from general where date_time_stamp!='_isempty' order by a limit c,2 _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users