Reputation: 5113
I would like to convert the following query to SqlAlchemy, but the documentation isn't very helpful:
select * from (
select *,
RANK() OVER (PARTITION BY id ORDER BY date desc) AS RNK
from table1
) d
where RNK = 1
Any suggestions?
Upvotes: 25
Views: 19351