-1
Table :-Person
Column:-day_phone, alt_phone ,Home_phone
條件: - 如果day_phone爲null,則alt_phone
如果兩個沒有數據那麼複製HOME_PHONE請告訴如何if語句CASE條件在mysql中使用2005年
Table :-Person
Column:-day_phone, alt_phone ,Home_phone
條件: - 如果day_phone爲null,則alt_phone
如果兩個沒有數據那麼複製HOME_PHONE請告訴如何if語句CASE條件在mysql中使用2005年
的應用情況,並與運營商
select Person
, case when day_phone is null then alt_phone
when day_phone is null and lt_phone is null then Home_phone
end
from my_table
你可以使用COALESCE函數將返回第一個非空值:
select coalesce(day_phone, alt_phone, Home_phone)
from person