paste #T1
:
SELECT me.id, me.station_market_id, me.open_time, me.close_time, me.first_time, me.last_time, station_market_data_commodities.station_market_data_id, station_market_data_commodities.commodity_id, station_market_data_commodities.min_buy_price, station_market_data_commodities.max_buy_price, station_market_data_commodities.first_buy_price, station_market_data_commodities.last_buy_price, station_market_data_commodities.min_sell_price, station_market_data_commodities.max_sell_price, station_market_data_commodities.first_sell_price, station_market_data_commodities.last_sell_price, station_market_data_commodities.min_demand, station_market_data_commodities.max_demand, station_market_data_commodities.first_demand, station_market_data_commodities.last_demand, station_market_data_commodities.min_supply, station_market_data_commodities.max_supply, station_market_data_commodities.first_supply, station_market_data_commodities.last_supply FROM station_market_data me LEFT JOIN station_market_data_commodity station_market_data_commodities ON (station_market_data_commodities.station_market_data_id = me.id AND station_market_data_commodities.commodity_id = 69) WHERE ( ( close_time < '2024-01-01T00:00:00Z' AND open_time >= '2018-01-01T00:00:00Z' AND station_market_id = 3223901184 ) ) ORDER BY open_time ASC;
SELECT
me.id,
me.station_market_id,
me.open_time,
me.close_time,
me.first_time,
me.last_time,
station_market_data_commodities.station_market_data_id,
station_market_data_commodities.commodity_id,
station_market_data_commodities.min_buy_price,
station_market_data_commodities.max_buy_price,
station_market_data_commodities.first_buy_price,
station_market_data_commodities.last_buy_price,
station_market_data_commodities.min_sell_price,
station_market_data_commodities.max_sell_price,
station_market_data_commodities.first_sell_price,
station_market_data_commodities.last_sell_price,
station_market_data_commodities.min_demand,
station_market_data_commodities.max_demand,
station_market_data_commodities.first_demand,
station_market_data_commodities.last_demand,
station_market_data_commodities.min_supply,
station_market_data_commodities.max_supply,
station_market_data_commodities.first_supply,
station_market_data_commodities.last_supply
FROM
station_market_data AS me
LEFT JOIN station_market_data_commodity AS station_market_data_commodities ON station_market_data_commodities.station_market_data_id = me.id AND
station_market_data_commodities.commodity_id = 69
WHERE
close_time < '2024-01-01T00:00:00Z' AND
open_time >= '2018-01-01T00:00:00Z' AND
station_market_id = 3223901184
ORDER BY
open_time ASC;
-- Formatted by Pg::SQL::PrettyPrinter