0
以下是我試圖在SQLAlchemy中編寫而沒有太多運氣的查詢的示例。我是很新的SQLA和我能夠在一定的查詢轉換,但不這樣的:SQLAlchemy - 聚合內部查詢加入到外部查詢
select car, min(units)
from (
select car,
(select sum(case when side = 0 then 1 else -1 end * doors)
from p.trades i
where i.car = o.car and i.date = o.date
and i.server_time <= o.server_time) units
from p.trades o
where date = '2016-01-19'
and car in ('Golf')
order by server_time, trade_id
) boff
group by car
任何人都可以有所幫助?
謝謝,非常感謝