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

sql2005视图统计NULL值,用什么基本词改为数值

2012-10-14 
sql2005视图统计NULL值,用什么关键词改为数值视图语句SQL codeSELECTc.branch, c.warehouseid, c.products

sql2005视图统计NULL值,用什么关键词改为数值
视图语句

SQL code
 
SELECT    c.branch, c.warehouseid, c.productsid, c.sumnownumber, c.sumthisnumber, p.codingen, p.name, p.units, p.specifications, p.model, p.merchandiseid,
                      p.recycle, c.faxprice, p.minimum, p.ceiling, p.coding, p.pinyin, c.sumplannumber,
                          (SELECT    SUM(plannumber) AS numberplannumber
                            FROM          dbo.stock_default AS d
                            WHERE      (c.warehouseid = warehouseid) AND (c.productsid = productsid) AND (c.branch = branch) AND (type = 1) AND (recycle = 1))
                      AS numberplannumber,
                          (SELECT    SUM(plannumber) AS numberyieldinplannumber
                            FROM          dbo.view_yield_in AS d
                            WHERE      (c.warehouseid = warehouseid) AND (c.productsid = productsid) AND (c.branch = branch) AND (recycle = 1)) AS numberyieldinplannumber,
                          (SELECT    SUM(plannumber) AS numberyieldoutplannumber
                            FROM          dbo.view_yield_out AS d
                            WHERE      (c.warehouseid = warehouseid) AND (c.productsid = productsid) AND (c.branch = branch) AND (recycle = 1)) AS numberyieldoutplannumber,
                          (SELECT    SUM(plannumber) AS numberstockinplannumber
                            FROM          dbo.view_stock_in AS d
                            WHERE      (c.warehouseid = warehouseid) AND (c.productsid = productsid) AND (c.branch = branch) AND (recycle = 1)) AS numberstockinplannumber,
                          (SELECT    SUM(plannumber) AS numberstockinreturnplannumber
                            FROM          dbo.view_stock_in_return AS d
                            WHERE      (c.warehouseid = warehouseid) AND (c.productsid = productsid) AND (c.branch = branch) AND (recycle = 1))
                      AS numberstockinreturnplannumber,
                          (SELECT    SUM(plannumber) AS numberstockoutplannumber
                            FROM          dbo.view_stock_out AS d
                            WHERE      (c.warehouseid = warehouseid) AND (c.productsid = productsid) AND (c.branch = branch) AND (recycle = 1))


                      AS numberstockoutplannumber,
                          (SELECT    SUM(plannumber) AS numberstockoutreturnplannumber
                            FROM          dbo.view_stock_out_return AS d
                            WHERE      (c.warehouseid = warehouseid) AND (c.productsid = productsid) AND (c.branch = branch) AND (recycle = 1))
                      AS numberstockoutreturnplannumber
FROM        dbo.products AS p INNER JOIN
                      dbo.view_stock_counts AS c ON p.productsid = c.productsid


视图 图片如图


我要的结果是
如果值为空 不显示 NULL, 显示0

[解决办法]
isnull(列明,数值)
[解决办法]
探讨
isnull(列明,数值)

[解决办法]
isnull(列名,0)
[解决办法]
探讨
isnull(列名,0)

[解决办法]
SQL code
isnull(列名,0)
[解决办法]
LS正解我蹭分

热点排行