I have a mysql table like below
id trader price
111 abc 5
222 xyz 5.20
333 abc 5.70
444 xyz 5
555 abc 5.20
I want to have a result to find the number of times each trader increased or decreased price as below
id trader price lagged_price flag
111 abc 5
222 xyz 5.20 5
333 abc 5.70 5.20 increased
444 xyz 5 5.70 increased
555 abc 5.20 5 reduced
5.20 increased
lagged_price is the column which lags the original column price. I need to have a flag saying that at a particular time the trader increased or decreased price in the above case the final result is
trader abc increased price twice trader xyz increased price ones and decreased price ones