0

I can easily insert into database for enum columns or update them via enum index... For example I have an enum column ('first','second','third') => (0,1,2)! When I want to insert first for column , I will pass the 0 to insert and like this for other values.... How can I get the values now? For example

SELECT * FROM table WHERE primary_id = 1

Now I want to get the enum column value index of this row. if the enum column value is 'second', how can I get index 1?

1 Answer 1

0

You should not be using numbers as enumeration value as enum type states in doc. The index of the enum item is returned, not the enum value itself.

Also check here ISSUE: Mysql converting Enum to Int

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.