I have an MySQL database and a table table1 with columns:
idof uint type- some other, not important now fields (like
name,ageetc.), statusof enum type(met, like, love, hate, kill).
For the inserted row (1, love), i want to select the "next" status (hate).
My attempt:
I tried:
SELECT (status + 1) FROM table1 WHERE id = 1
but it retured 4 (index, not text value).
Of course:
SELECT status FROM table1 WHERE id = 1
returns love (text value, not index).
Question:
Is there an way to achive it (some kind of "casting" maybe)?
I preffer solution that do not mess with database schema tables.
Also, I could UPDATE that row with status = status + 1, than select it and after it UPDATE again with status = status - 1, but it's even worse idea...
Edit
As I have been asked to give some more details:
I do not have any additional table that hold the order of my enum. I just added it with phpMyAdmin, and the selection from it works as I described.
Moreover when I update the table with status = status + 1 i get hate from love.