Re: [sqlite] Using non-aggregate columns in group by (with an additional issue)

2012-01-14 Thread David Garfield
A very minor change on your query is all that is needed. select max(x.timestamp),x.value,x.person from table as x, (select person,max(value) as maxvalue from table group by person order by maxvalue desc) as y where x.person = y.person and x.value = y.maxvalue group by x.person, x.value I don't

Re: [sqlite] Using non-aggregate columns in group by (with an additional issue)

2012-01-13 Thread Dilip Ranganathan
On Fri, Jan 13, 2012 at 6:22 AM, Simon Slavin wrote: > > On 13 Jan 2012, at 11:07am, Dilip Ranganathan wrote: > > > I have a table that looks like something like this: > > > >timestampvalue person > >=== > >2010-01-

Re: [sqlite] Using non-aggregate columns in group by (with an additional issue)

2012-01-13 Thread Luuk
On 13-01-2012 12:07, Dilip Ranganathan wrote: > I have a table that looks like something like this: > > timestampvalue person > === > 2010-01-12 00:00:00 33 emp1 > 2010-01-12 11:00:00 22

Re: [sqlite] Using non-aggregate columns in group by (with an additional issue)

2012-01-13 Thread Simon Slavin
On 13 Jan 2012, at 11:07am, Dilip Ranganathan wrote: > I have a table that looks like something like this: > >timestampvalue person >=== >2010-01-12 00:00:00 33 emp1 >2010-01-12 11:00:00

[sqlite] Using non-aggregate columns in group by (with an additional issue)

2012-01-13 Thread Dilip Ranganathan
I have a table that looks like something like this: timestampvalue person === 2010-01-12 00:00:00 33 emp1 2010-01-12 11:00:00 22 emp1 2010-01-12 09:00:00 16