mysql> SELECT id,enum_col+0 FROM tbl_name where rowid=2;
where enum_col is a coloumn of Enum type in MYSQL
tbl_name is name of your table
This query will return the current index value of enum_col enum {'One','Two','Three'} instead of string 'One' , 'Two' or 'Three' for which rowid= 2
rowid enum_col
1 One
2 Two
3 Three
Result for SELECT id,enum_col FROM tbl_name where rowid=2;
rowid enum_col
2 Two
Result for SELECT id,enum_col+0 As enum_index FROM tbl_name where rowid=2;
rowid enum_index
2 2
where enum_col is a coloumn of Enum type in MYSQL
tbl_name is name of your table
This query will return the current index value of enum_col enum {'One','Two','Three'} instead of string 'One' , 'Two' or 'Three' for which rowid= 2
rowid enum_col
1 One
2 Two
3 Three
Result for SELECT id,enum_col FROM tbl_name where rowid=2;
rowid enum_col
2 Two
Result for SELECT id,enum_col+0 As enum_index FROM tbl_name where rowid=2;
rowid enum_index
2 2
No comments:
Post a Comment