Prøv denne
SELECT p1.*, (
SELECT price_cents
FROM "prices" p
WHERE p1.game_id = p.game_id
ORDER BY p.created_at DESC LIMIT 1 OFFSET 1
) as price_cents
FROM "prices" p1
OPDATERING ifølge forfatterens kommentar
Hvis du har brug for mere end én kolonne fra den anden seneste post, kan du prøve at følge uddrag
SELECT * FROM (
SELECT p.*, (
SELECT id
FROM "prices"
WHERE p.game_id = game_id
ORDER BY created_at DESC LIMIT 1 OFFSET 1
) AS second_id
FROM "prices" p
) p1 INNER JOIN "prices" p2 ON p1.second_id = p2.id