I have the following table and I need to find two consecutive days which have different status for the same person (No gap between days).
name date status
-------------------------------
John 2020-06-01 submitted
John 2020-06-02 pending
John 2020-06-03 approved
John 2020-06-04 approved
Amy 2020-06-02 pending
Amy 2020-06-03 pending
Amy 2020-06-04 pending
Dan 2020-06-02 submitted
Dan 2020-06-03 approved
Dan 2020-06-04 approved
Mary 2020-06-03 submitted
Mary 2020-06-04 pending
output should like below:
name date status
-------------------------------
John 2020-06-01 submitted
John 2020-06-02 pending
John 2020-06-03 approved
Dan 2020-06-02 submitted
Dan 2020-06-03 approved
Mary 2020-06-03 submitted
Mary 2020-06-04 pending
Currently I exported the table and wrote a python code to do that. However, I am wondering would it be possible to achieve that just using SQL? (I looked into SQL: retrieve only the records whose value has changed , but couldn't figure out how to make it work in my case since the status
field is a string instead of number) Thanks!