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
任何人都可以有所帮助?
谢谢,非常感谢