Let’s say I have a table that looks something like this:
-------------------------------
id|column2|column3 |column4
-------------------------------
1 value1 somevalue somevalue
2 value2 somevalue somevalue
3 value2 somevalue somevalue <----- I want this column deleted
4 value3 somevalue somevalue
As you can see I want to delete the rows where the current and the previous row have the same value in column2.
I would try something like
For your specific query, I would use the
t2.Id + 1 = t1.Idinstead oft2.Id < t1.Idas this would delete for any occurances, not consecutive entries only.