feat: separate sql
This commit is contained in:
40
backend/app/sql/listing_select.sql
Normal file
40
backend/app/sql/listing_select.sql
Normal file
@@ -0,0 +1,40 @@
|
||||
select
|
||||
l.global_id,
|
||||
l.tiny_id,
|
||||
l.url,
|
||||
l.title,
|
||||
l.city,
|
||||
l.postcode,
|
||||
l.province,
|
||||
l.neighbourhood,
|
||||
l.municipality,
|
||||
l.latitude,
|
||||
l.longitude,
|
||||
l.object_type,
|
||||
l.house_type,
|
||||
l.offering_type,
|
||||
l.construction_type,
|
||||
l.construction_year,
|
||||
l.energy_label,
|
||||
l.living_area,
|
||||
l.plot_area,
|
||||
l.bedrooms,
|
||||
l.rooms,
|
||||
l.has_garden,
|
||||
l.has_balcony,
|
||||
l.has_solar_panels,
|
||||
l.has_heat_pump,
|
||||
l.has_roof_terrace,
|
||||
l.is_energy_efficient,
|
||||
l.is_monument,
|
||||
l.current_price,
|
||||
l.status,
|
||||
l.price_per_sqm,
|
||||
l.publication_date,
|
||||
coalesce(r.elo_rating, :default_elo) as elo_rating,
|
||||
coalesce(r.comparison_count, 0) as comparison_count,
|
||||
coalesce(r.wins, 0) as wins,
|
||||
coalesce(r.losses, 0) as losses
|
||||
from {listings_schema}.{listings_table} as l
|
||||
left join {elo_schema}.ratings as r
|
||||
on l.global_id = r.global_id
|
||||
Reference in New Issue
Block a user