Supposing we have a field status (0
for disabled, 1
for enabled), and we need to get the literal values directly using MySQL, in other words: if we requested the query:
select status
from `<table>`
We need the column to appear like this:
status
----------
disabled
enabled
not as following:
status
--------
0
1
Knowing that we don't have a mysql status table to join with and get the values as usual.
You would use a case statement, such as this:
select (case when status = 0 then 'disabled'
when status = 1 then 'enabled'
end)
from . . .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With