我有一个查询,看起来像这样:有,如果custom_error的default_error的价值MySQL:如何从另一列中选择一个列的值,具体取决于哪些列是空的?
SELECT id, description, default_error, custom_error FROM `table1`;
这给了我
(int) (Text) (Varchar) (Varchar)
id Description Default_Error custom_error
---------------------------------------------------
1 Hello Error 123
2 World Error 456 This is a custom Error
我想选择一个额外的列(“错误”)是EMPTY,如果custom_error不是EMPTY,则为custom_error的值。
任何想法如何在MySQL中做到这一点?