I am looking for a solution for table ‘A” which structure is:
ID NAME SHOWN
1 Eddie 0
2 Marie 1
3 Shawn 15
4 Frank 12
5 Danny 7
I’d like to commit a SELECT on this table so that for each resulted row, the ‘SHOWN‘ would increase, so for example:
SELECT * from 'A' WHERE `ID`>3;
would cause table ‘A’ the following change:
ID NAME SHOWN
1 Eddie 0
2 Marie 1
3 Shawn 15
4 Frank 13
5 Danny 8
Only Frank and Danny’s ID is bigger than 3, so the resulting SELECT would yield Frank and Danny and so, their respective ‘SHOWN‘ column is increased by 1
How can I achieve this behavior?
You may update your table with the expected increment then.
Check the this reference out 🙂
SQLFIDDLE