SELECT id FROM `table` GROUP BY value ORDER BY id DESC
array(2) {
[0]=>
array(1) {
["id"]=>
string(1) "1"
}
[1]=>
array(1) {
["id"]=>
string(1) "3"
}
}
array(2) {
[0]=>
array(1) {
["id"]=>
string(1) "5"
}
[1]=>
array(1) {
["id"]=>
string(1) "4"
}
}
SELECT id FROM (select id, value from `table` ORDER BY id desc) as tbl GROUP BY value