首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

对查询结果没有的情况上用零代替结果

2012-12-17 
对查询结果没有的情况下用零代替结果select isNull(PremiumOld,0) as PremiumOld from view_Prodect where

对查询结果没有的情况下用零代替结果
select isNull(PremiumOld,0) as PremiumOld from view_Prodect where Material='304HC' and  [Name]='GB818' and Specification='M1.6*18'
union all
select 0 as PremiumOld from (select 0 as A) as TB where not exists(select 1 from view_Prodect 
where Material='304HC' and  [Name]='GB818' and Specification='M1.6*18') 

热点排行