Skip to content
Advertisement

How to generate the sequence number based on condition in sql server

I need to display a New Sequence column value based on the Score 1 or 0.

I am trying to achieve on of the calculation in my project based on the new sequence value.

I have tried sum(score) over (Order By Date rows unbounded preceding)

Advertisement

Answer

I use mysql because the online tool but very similar in sql server.

SQL DEMO

OUTPUT

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement