Skip to content
Advertisement

Get count of records changing status

I am trying to figure the best way to get a count of how many times a record was sent back to the user (Status changed from 3 or 4 back to 1)

this is what my data looks like

Advertisement

Answer

SQL tables represent unordered sets. There is no “previous” or “next” row, unless a column specifies the ordering.

Your data does not seem to have such a column. But if you did, you could use lag():

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