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

2012-01-13 Thread Dilip Ranganathan
On Fri, Jan 13, 2012 at 9:10 AM, Igor Tandetnik  wrote:

> Dilip Ranganathan  wrote:
> > Suppose among emp1 and emp2, I only want to see the entry with the latest
> > timestamp.
>
> select timestamp, value, person from mytable t1
> where rowid = (
>select rowid from mytable t2 where t1.person=t2.person
>order by value desc, timestamp desc limit 1);
>
>
Igor
Thank you very very much. That worked like a charm.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2012-01-13 Thread Igor Tandetnik
Dilip Ranganathan  wrote:
> Suppose among emp1 and emp2, I only want to see the entry with the latest
> timestamp.

select timestamp, value, person from mytable t1
where rowid = (
select rowid from mytable t2 where t1.person=t2.person
order by value desc, timestamp desc limit 1);

-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users