- or download this
SELECT DISTINCT ON (id) id, description
FROM list_index li
ORDER BY id, rpt_key DESC;
- or download this
SELECT DISTINCT id,
(SELECT description from list_index li_i
WHERE li_i.id = li_o.id
ORDER BY created_at DESC limit 1) AS description
FROM list_index li_o;
- or download this
SELECT id,
(SELECT description from list_index li_i
...
ORDER BY created_at DESC limit 1) AS description
FROM
(SELECT DISTINCT id FROM list_index) li_o;