【问题】
Hello i'm trying to create a rally Up rally DOWN stock indicator. i have thre columns :
Date Price Result
1/1/2015 3 1 here start from 1
2/1/2015 4 2
3/1/2015 347 3
4/1/2015 464 4
5/1/2015 35 5
6/1/2015 363 6
7/1/2015 -5 1 here restart from 1 because it is negative
8/1/2015 -3 2
9/1/2015 -5 3
10/1/2015 37 1 here restart from 1 because it is positive
11/1/2015

博客讨论了如何在MySQL中计算股票连续涨跌的指标。用户提出需要根据价格变化计算正负连续天数,并在RESULT列中显示。尽管SQL解决方案可能复杂,但通过SPL辅助,可以实现两行代码的简洁解决方案,利用Price的变化来更新RESULT字段的计数。
最低0.47元/天 解锁文章
686

被折叠的 条评论
为什么被折叠?



