Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Rows Where the Value Changed

A status log lists the status of each entity over time. Return only the rows where the status differs from the previous row of the same entity (the first row always counts). Order by id.

Table schema

StatusLog(id INT PRIMARY KEY, entity VARCHAR(5), status VARCHAR(10))

Sample data

id | entity | status
1 | A | new
2 | A | new
3 | A | active
4 | A | active
5 | A | closed

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.