Files
house-elo-ranking/backend/app/sql/history.sql
2026-03-06 14:51:26 +00:00

15 lines
466 B
SQL

select
c.*,
a.title as listing_a_title,
b.title as listing_b_title,
w.title as winner_title
from {{ elo_schema }}.comparisons as c
left join {{ listings_schema }}.{{ listings_table }} as a
on c.listing_a_id = a.global_id
left join {{ listings_schema }}.{{ listings_table }} as b
on c.listing_b_id = b.global_id
left join {{ listings_schema }}.{{ listings_table }} as w
on c.winner_id = w.global_id
order by c.created_at desc
limit :limit