You need to get the previous value. This version uses MySQL syntax with a correlated subquery to get the result:
select t.*
from (select t.*,
(select cxp from t t2 where t2.date < t.date order by date desc limit1
) as prevcxp
from t
) t
where prevcxp is NULL or prevcxp <> cxp
In other databases, you might use lag()
instead of the subquery, the limit
might be replaced by a top
or even fetch first 1 row
.