oracle中:select nvl(字段名,0) from 表名;
sqlserver中:select isnull(字段名,0) from 表名;
mysql中:select ifnull(字段名,0) from 表名;
mysql举例:

select a.stu_id,a.course_id,(IFNULL(a.score,0)+IFNULL(b.score,0))  score
 	from a left join b 
	on a.stu_id = b.stu_id and a.course_id = b.course_id

 

 


                  
                  

Logo

更多推荐