Hi I am looking to build logic using SQL, to achieve below.
Essentially needing to do the cumsum but only where there are consecutive 1's. It's daily level data.
I have achieved this in Excel by creating two supporting column but not being able to achieve same using SQL ( tried several rankings and partitions but did not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.