如:
select (t.num_1 + t.num_2) from table t
字段num_1有可能为null ,如果该条记录的num_1为空值,则用0和num_2相加。这个sql语句怎么写。
最好oracle和sql server的都写写。
select (t.num_1 + t.num_2) from table t
字段num_1有可能为null ,如果该条记录的num_1为空值,则用0和num_2相加。这个sql语句怎么写。
最好oracle和sql server的都写写。
2015-11-09 23:10
最佳答案
在sql中 空值有NULL 和''的形式 当是NULL的时候用 IS NULL判断 当是''的时候用 =''判断 比如 select * from table where enddate IS NULL; select * from table where str='';