Monday, July 24, 2017

MySQL BIT field values are not being displayed properly when using SELECT command


Suppose if we have created a mysql table with bit type, while using SELECT sql command, the results returned will not be readable and visible.

Therefore by using the cast function, we can easily fix this

SELECT id, CAST(enabled AS UNSIGNED) AS enabled FROM my_table

No comments:

Post a Comment