次のSQLselectステートメントでは、nameがnullの場合に国籍を出力し、SQL句のif構文が機能していますが、次のように国籍が出力されません。
table test2
id integer
case integer
nationality char(10)
name char(24)
1 1 france ""
2 2 england john
select t.id,
if(t.name is null, t.nationality, t.name)
as name_equivalent
from test2 t;
idname_equivalentを生成します
1 ""
2 john
何故ですか?ありがとうございました。