On 13 Jan 2012, at 11:07am, Dilip Ranganathan wrote: > I have a table that looks like something like this: > > timestamp value person > =============================================== > 2010-01-12 00:00:00 33 emp1 > 2010-01-12 11:00:00 22 emp1 > 2010-01-12 09:00:00 16 emp2 > 2010-01-12 08:00:00 16 emp2 > 2010-01-12 12:12:00 45 emp3 > 2010-01-12 13:44:00 64 emp4 > 2010-01-12 06:00:00 33 emp1 > 2010-01-12 15:00:00 12 emp5 > > I wanted to find the maximum value associated with each person.
Do you have another table with your persons in it ? In other words, can you do SELECT code FROM people ORDER BY code ? If so, that gives you a list of people to start from. Then you can do something like SELECT people.code, max(scores.score) FROM people JOIN scores on scores.person = person.code ORDER BY people.code Note: the above is off the top of my head and untested. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users