QuXiangjie / Study-Review

自己欠缺的还太多了,希望通过总结每天的学习内容,整理每天的思绪来丰富自己的知识库。我想成为一名优秀的金融数据分析师,并行发展技术与商业业务。博客内容为:数理统计、财务业务、Python(数据分析及可视化)、Excel(数据分析)、SQL、英文
0 stars 0 forks source link

1204. Last Person to Fit in the Bus #31

Open QuXiangjie opened 4 months ago

QuXiangjie commented 4 months ago

1204. Last Person to Fit in the Bus If I want to have a cumulative sum up. I can use the over function behind thesum and control it

SELECT person_name,turn,
sum(weight) over (order by turn) AS cum 
FROM queue
where cum<=1000 
order by turn DESC 
limit 1;