Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-12 Thread Clemens Ladisch
Clemens Regards, 2. Sorting the entries before LIMIT is applied. 1. Sorting the entries before group_concat() is applied; or Chris Locke wrote: > Whats the benefit of getting a sorted query and then sorting that query > again? > > On Tue, Jul 12, 2016 at 12:45 AM, Stephen Chrzanowski

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-12 Thread Chris Locke
Whats the benefit of getting a sorted query and then sorting that query again? On Tue, Jul 12, 2016 at 12:45 AM, Stephen Chrzanowski wrote: > Simons + My answer; > > select * from (SELECT date_time_stamp FROM general ORDER BY date_time_stamp > DESC LIMIT 2) a order by

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-12 Thread Keith Christian
Thanks for all of the responses. Duplicates are OK, the date time stamps are part of a log file that I am trying to develop a query for. I couldn't get the LIMIT/OFFSET part of the query right after several attempts so I thought I'd ask the experts here. I appreciate your replies and

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-11 Thread J Decker
SELECT DISTINCT date_time_stamp FROM general ORDER BY date_time_stamp DESC LIMIT 2 isn't it simply to use DISTINCT? On Mon, Jul 11, 2016 at 4:25 PM, Keith Christian wrote: > A table has a column of dates and times that look like this: > > 2015-10-02 07:55:02 >

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-11 Thread R Smith
On 2016/07/12 1:25 AM, Keith Christian wrote: 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,

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-11 Thread Stephen Chrzanowski
Simons + My answer; select * from (SELECT date_time_stamp FROM general ORDER BY date_time_stamp DESC LIMIT 2) a order by date_time_stamp; On Mon, Jul 11, 2016 at 7:33 PM, Simon Slavin wrote: > > On 12 Jul 2016, at 12:25am, Keith Christian >

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-11 Thread Simon Slavin
On 12 Jul 2016, at 12:25am, Keith Christian wrote: > 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 (