日期:2014-05-17  浏览次数:20504 次

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