88

私は次のものを持っています:

Select Coalesce(Other,Industry) Ind from registration

問題はOther、空の文字列またはNULL. 空の文字列の場合でも を返すcoalesceようにするにはどうすればよいですか?OtherCoalesceIndustry

4

3 に答える 3

189

CASE式またはを使用しNULLIFます。

SELECT COALESCE(NULLIF(Other,''),Industry) Ind FROM registration
于 2013-06-24T19:58:52.237 に答える
28

これを試して

Select Coalesce(nullif(Other,''),Industry) Ind from registration
于 2013-06-24T19:58:58.347 に答える