DISTINCT ON
に基づいたクリーンバージョンを提案します (ドキュメントを参照):
SELECT DISTINCT ON (usr_id)
time_stamp,
lives_remaining,
usr_id,
trans_id
FROM lives
ORDER BY usr_id, time_stamp DESC, trans_id DESC;
DISTINCT ON
に基づいたクリーンバージョンを提案します (ドキュメントを参照):
SELECT DISTINCT ON (usr_id)
time_stamp,
lives_remaining,
usr_id,
trans_id
FROM lives
ORDER BY usr_id, time_stamp DESC, trans_id DESC;