jaymc Posted July 15, 2009 Share Posted July 15, 2009 I have an ENUM field of either 1, 0. However really I want to show 1 as Yes and 0 as No. How can I make it output it as Yes/No even though I store it as 1/0 This must be done in the query, no php str_replace etc. Quote Link to comment https://forums.phpfreaks.com/topic/166099-solved-enum/ Share on other sites More sharing options...
rhodesa Posted July 15, 2009 Share Posted July 15, 2009 Why must it be done in the query? Try this: SELECT (CASE fieldName WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' ELSE 'No' END) FROM tableName Quote Link to comment https://forums.phpfreaks.com/topic/166099-solved-enum/#findComment-875951 Share on other sites More sharing options...
jaymc Posted July 15, 2009 Author Share Posted July 15, 2009 Cheers, Worked Quote Link to comment https://forums.phpfreaks.com/topic/166099-solved-enum/#findComment-876002 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.