天天看點

不同資料庫中兩列字段相減(某列有空值)

資料庫中兩個字段相減(某列有空值)處理方法:

sql server中:select (isnull(字段1,0)-isnull(字段2,0)) as 結果 from 表

oracle中:select (nvl(字段1,0)-nvl(字段2,0)) as 結果 from 表

mysql中:select (ifnull(字段1,0)=ifnull(字段2,0)) as 結果 from 表