This is my table's current status.
id operation position
------------------------
1 EDIT 0
1 DELETE 0
2 VIEW 0
3 DELETE 0
3 VIEW 0
3 EDIT 0
I want to update position value in mysql say if for id = 1
1st entry set to 0 second occurrence for same id incremented by 1. So my final output should be like
id operation position
------------------------
1 EDIT 0
1 DELETE 1
2 VIEW 0
3 DELETE 0
3 VIEW 1
3 EDIT 2
How can i achive that, any hints ?