I have a following db format set up:
id fid name time flag
1 224 Mike 112 3
2 555 John 98 5
3 224 Mike 101 0
4 121 Ann 80 1
5 224 Mike 55 7
6 121 Ann 150 4
I used following query to sort and display them grouped by fid (or name) and to sort them by lowest time:
SELECT id, fid, name, MIN(time), flag FROM dblist GROUP BY name ORDER BY MIN(time)
This works fine as I get the output in order I want. Something like:
name time
Mike 55
Ann 80
John 98
However, if I try to display fid, flag, or any other fields that are associated with that particular time record I get some other values (presumably first that query comes across).
What I would like to get is following format:
id fid name time flag
5 224 Mike 55 7
4 121 Ann 80 1
2 555 John 98 5
I am wondering if there is a way to get this done with just one database and some other query syntax?
Thanks.