Hello,
I have a table with three columns of interest:
type int(1)
value int(3)
time_accessed timestamp(14)
Here is some sample data:
Quote:
type, value, time_accessed
1, 3, 20040611154031
0, 3, 20040611154000
0, 533, 20040601154031
1, 533, 20030611154031
|
Now, what I'd like to have, is a single query, that returns DISTINCT 'value', and only latest type per value, ex return:
type, value:
1, 3
0, 533
Anyone know how this is done? My instinct was:
SELECT DISTINCT value, type FROM table_a ORDER BY time_accessed DESC;
The problem however, is that this returns each 'type' entry..
Help appreciated!
A