私は自分のサイトを開発しましたが、それは私のローカルマシンの魅力のように機能します。クエリは、このスレッドの仲間のStackoverflowメンバーによって提供されます。
ローカルでHerokuと同じデータ。
select *
from (
select *
, row_number() over (partition by odds_type order by odds_index desc) as rn2
from (
select *
, row_number() over (partition by event_id, bookmaker_id, odds_type
order by created_at desc) as rn1
from Odds
where event_id = #{e.id}
) sub1
where rn1 = 1
) sub2
where rn2 = 1
コンソールのエラー
Odds Load (88.4ms) select * from ( select *, row_number() over (partition by odds_type order by odds_index desc) as rn2 from (select *, row_number() over (partition by event_id, bookmaker_id, odds_type order by created_at desc) as rn1 from Odds where event_id = 21 ) sub1 where rn1 = 1 ) sub2where rn2 = 1
ActiveRecord::StatementInvalid: PG::Error: ERROR: syntax error at or near "over"
LINE 1: select * from ( select *, row_number() over (partition by od...
^