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. 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 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 Link to comment https://forums.phpfreaks.com/topic/166099-solved-enum/#findComment-876002 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.