[易飞]新品销售额分析

新品销售分析:新品滚动12月销售额/当月销售额

分析:新品包含全新产品,新客户老产品转化成程序语言定义:产品首次销货日期在去年同期之前定义为新品。维度:产品系列,月度,月度 占比,季度,季度占比,新品占比当月合计,新品占比本年累计

SQL:

USE [ZM]
GO
/****** Object:  StoredProcedure [dbo].[DZ_NewPrdSales]    Script Date: 2020/3/30 8:05:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================      
-- Author: <David Gong>      
-- Create date: <2020-03-23>      
-- Description: <新品销售额统计分析>
-- 当月(收入)产品首次交易在去年同期以前则是旧品
-- 否则为新品      
-- =============================================
ALTER Proc [dbo].[DZ_NewPrdSales]
(
	 @Year AS  CHAR(4)
)
AS
BEGIN

--SET @Year='2018';

--判断临时表是否存在
IF OBJECT_ID(N'tempdb.dbo.#T1') IS NOT NULL
BEGIN
    DROP TABLE #T1 
END
IF OBJECT_ID(N'tempdb.dbo.#TALL') IS NOT NULL
BEGIN
    DROP TABLE #TALL
END
;
WITH CT AS(
SELECT   TA003 审核日期,TB005+'-'+rtrim(TB006)+'-'+TB007 单据,LA004 交易日期,datepart(month,LA004) 月份,CASE WHEN TA079='1' THEN '蓝字' ELSE '红字' END AS 单据类型,
CASE WHEN TA001 in ('6101','6102','6103','6104','6201')  then '内销' else '外销' END AS 内外销,MR003 区域,
TA001+'-'+TA002 销售发票,
Rtrim(COPMA.MA001) 客户,
COPMA.MA002 客户简称,
ME002 业务部门,
MV002 业务员,
TB039 品号,
TB040 品名,
TB041 规格,
A1.MA003 品号分类一,
A2.MA003 品号分类四,
CASE WHEN TA079='1' THEN convert(decimal(15,2),TB022) ELSE -1*convert(decimal(15,2),TB022)  end as  开票数量, 
CASE WHEN TA079='1' THEN TB019 ELSE -1*TB019  end as 本币无税金额, 
CASE WHEN TA079='1' THEN TB020 ELSE -1*TB020  end as 本币税额,
CASE WHEN TA079='1' THEN convert(decimal(15,2),TB022)*LA012 ELSE -1*convert(decimal(15,2),TB022)*LA012  end as  销货成本,
TB019-convert(decimal(15,2),TB022*LA012) 销货毛利, --(TB019-LA013)
case when TB019<>0 then CAST(convert(decimal(15,2),(TB019-convert(decimal(15,2),TB022*LA012))/TB019*100) AS NVARCHAR)+'%' else '0' end as 销货毛利率
FROM  ACRTB left JOIN ACRTA ON TA001=TB001 AND TA002=TB002
            LEFT JOIN COPMA ON TA004=MA001
            LEFT JOIN INVMB ON TB039=MB001
	        LEFT JOIN INVLA ON LA006=TB005 AND LA007=TB006 AND LA008=TB007
            LEFT JOIN CMSME ON ME001=TA070
            LEFT JOIN CMSMV ON MV001=TA005
            LEFT JOIN (SELECT MA003,MA002 FROM INVMA WHERE MA001='1') A1 ON A1.MA002=MB005
            LEFT JOIN (SELECT MA003,MA002 FROM INVMA WHERE MA001='3') A2 ON A2.MA002=MB007
 		    LEFT JOIN (SELECT MR002,MR003 from CMSMR where MR001='2') R ON MA076=R.MR002
WHERE left(TA003,4)=@Year  AND TB004 in ('1','2')  and TA025='Y' AND TA003<>'61B3'

--UNION ALL
--SELECT TA003 审核日期,NULL 单据,TA004 交易日期,'' 月份,CASE WHEN TA079='1' THEN '蓝字' ELSE '红字' END AS 单据类型,
--CASE WHEN TA001 in ('6101','6102','6103','6104','6201')  then '内销' else '外销' END AS 内外销,MR003 区域,
--TA001+'-'+TA002 销售发票,
--Rtrim(COPMA.MA001) 客户,
--COPMA.MA002 客户简称,
--ME002 业务部门,
--MV002 业务员,
--TB039 品号,
--TB040 品名,
--TB041 规格,
--A1.MA003 品号分类一,
--A2.MA003 品号分类四,
--CASE WHEN TA079='1' THEN convert(decimal(15,2),TB022) ELSE -1*convert(decimal(15,2),TB022)  end as  开票数量, 
--CASE WHEN TA079='1' THEN TB019 ELSE -1*TB019  end as 本币无税金额, 
--CASE WHEN TA079='1' THEN TB020 ELSE -1*TB020  end as 本币税额,
--0 销货成本,
--TB019 销货毛利,
--case when TB019<>0 then CAST(convert(decimal(15,2),(TB019)/TB019*100) AS NVARCHAR)+'%' else '0' end as 销货毛利率  
--FROM  ACRTB left JOIN ACRTA ON TA001=TB001 AND TA002=TB002
--            LEFT JOIN COPMA ON TA004=MA001
--            LEFT JOIN INVMB ON TB039=MB001
--	        --inner JOIN INVLA ON LA006=TB005 AND LA007=TB006 AND LA008=TB007
--            LEFT JOIN CMSME ON ME001=TA070
--            LEFT JOIN CMSMV ON MV001=TA005
--            LEFT JOIN (SELECT MA003,MA002 FROM INVMA WHERE MA001='1') A1 ON A1.MA002=MB005
--            LEFT JOIN (SELECT MA003,MA002 FROM INVMA WHERE MA001='3') A2 ON A2.MA002=MB007
-- 		    LEFT JOIN (SELECT MR002,MR003 from CMSMR where MR001='2') R ON MA076=R.MR002
--WHERE left(TA003,6)='201902'  AND TB004 ='9'  and TA025='Y' and TA001='6104'
)

SELECT DATEPART(MONTH,CT.审核日期) AS 月份,CT.品号分类四 AS 系列,--CT.品号分类一,CT.品号,
CT.本币无税金额,
CASE WHEN 品号分类一 IN('继电器成品','液晶模块') THEN '旧品' 
    WHEN 首次销货日期 IS NULL  AND 品号分类一 NOT IN('继电器成品','液晶模块')  THEN '新品'            
    WHEN 首次销货日期 IS NOT NULL AND 品号分类一 NOT IN('继电器成品','液晶模块')  AND DATEDIFF(MONTH,DATEADD(MONTH,-12,审核日期),首次销货日期)>0  THEN '新品' 
	ELSE  '旧品' END AS  Item
	INTO #T1
 FROM CT
LEFT JOIN (SELECT MIN(日期) 首次销货日期, 品号 FROM [dbo].[V_LSHDALL] GROUP BY 品号) AS A ON A.品号=CT.品号
WHERE CT.本币无税金额<>0 AND 品号分类一<>'原材料'




---New---
SELECT 
Item,
系列,
ISNULL([1],0) [一月], 
ISNULL([2],0) [二月], 
ISNULL([3],0) [三月], 
ISNULL([4],0) [四月], 
ISNULL([5],0) [五月], 
ISNULL([6],0) [六月], 
ISNULL([7],0) [七月], 
ISNULL([8],0) [八月], 
ISNULL([9],0) [九月], 
ISNULL([10],0) [十月], 
ISNULL([11],0) [十一月], 
ISNULL([12],0) [十二月]
INTO #TALL
FROM #T1 /*数据源*/
AS P
PIVOT
(
    SUM(本币无税金额/*行转列后 列的值*/) FOR
    P.月份/*需要行转列的列*/ IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])
) AS T


--SELECT * FROM #TALL

DECLARE @SumOld1 AS DECIMAL(18,2),@SumOld2 AS DECIMAL(18,2),@SumOld3 AS DECIMAL(18,2),@SumOld4 AS DECIMAL(18,2),@SumOld5 AS DECIMAL(18,2),@SumOld6 AS DECIMAL(18,2),
        @SumOld7 AS DECIMAL(18,2),@SumOld8 AS DECIMAL(18,2),@SumOld9 AS DECIMAL(18,2),@SumOld10 AS DECIMAL(18,2),@SumOld11 AS DECIMAL(18,2),@SumOld12 AS DECIMAL(18,2),@SumOldTotal AS DECIMAL(18,2)

DECLARE @SumNew1 AS DECIMAL(18,2),@SumNew2 AS DECIMAL(18,2),@SumNew3 AS DECIMAL(18,2),@SumNew4 AS DECIMAL(18,2),@SumNew5 AS DECIMAL(18,2),@SumNew6 AS DECIMAL(18,2),
        @SumNew7 AS DECIMAL(18,2),@SumNew8 AS DECIMAL(18,2),@SumNew9 AS DECIMAL(18,2),@SumNew10 AS DECIMAL(18,2),@SumNew11 AS DECIMAL(18,2),@SumNew12 AS DECIMAL(18,2),@SumNewTotal AS DECIMAL(18,2)

DECLARE @SumAll1 AS DECIMAL(18,2),@SumAll2 AS DECIMAL(18,2),@SumAll3 AS DECIMAL(18,2),@SumAll4 AS DECIMAL(18,2),@SumAll5 AS DECIMAL(18,2),@SumAll6 AS DECIMAL(18,2),
        @SumAll7 AS DECIMAL(18,2),@SumAll8 AS DECIMAL(18,2),@SumAll9 AS DECIMAL(18,2),@SumAll10 AS DECIMAL(18,2),@SumAll11 AS DECIMAL(18,2),@SumAll12 AS DECIMAL(18,2),@SumAllTotal AS DECIMAL(18,2)

DECLARE @SumOldQ1 AS DECIMAL(18,2),@SumOldQ2 AS DECIMAL(18,2),@SumOldQ3 AS DECIMAL(18,2),@SumOldQ4 AS DECIMAL(18,2)
DECLARE @SumNewQ1 AS DECIMAL(18,2),@SumNewQ2 AS DECIMAL(18,2),@SumNewQ3 AS DECIMAL(18,2),@SumNewQ4 AS DECIMAL(18,2)
DECLARE @SumAllQ1 AS DECIMAL(18,2),@SumAllQ2 AS DECIMAL(18,2),@SumAllQ3 AS DECIMAL(18,2),@SumAllQ4 AS DECIMAL(18,2)

---保存每月旧品汇总值
SELECT 
@SumOld1=SUM(一月),@SumOld2=SUM(二月), @SumOld3=SUM(三月), @SumOld4=SUM(四月), @SumOld5=SUM(五月), @SumOld6=SUM(六月),
@SumOld7=SUM(七月),@SumOld8=SUM(八月), @SumOld9=SUM(九月), @SumOld10=SUM(十月), @SumOld11=SUM(十一月), @SumOld12=SUM(十二月),
@SumOldTotal=SUM(一月)+SUM(二月)+SUM(三月)+SUM(四月)+SUM(五月)+SUM(六月)+SUM(七月)+SUM(八月)+SUM(九月)+SUM(十月)+SUM(十一月)+SUM(十二月)
FROM #TALL
WHERE Item='旧品'
GROUP BY Item

SET @SumOldQ1=@SumOld1+@SumOld2+@SumOld3
SET @SumOldQ2=@SumOld4+@SumOld5+@SumOld6
SET @SumOldQ3=@SumOld7+@SumOld8+@SumOld9
SET @SumOldQ4=@SumOld10+@SumOld11+@SumOld12

---保存每月新品汇总值
SELECT 
@SumNew1=SUM(一月),@SumNew2=SUM(二月), @SumNew3=SUM(三月), @SumNew4=SUM(四月), @SumNew5=SUM(五月), @SumNew6=SUM(六月),
@SumNew7=SUM(七月),@SumNew8=SUM(八月), @SumNew9=SUM(九月), @SumNew10=SUM(十月), @SumNew11=SUM(十一月), @SumNew12=SUM(十二月),
@SumNewTotal=SUM(一月)+SUM(二月)+SUM(三月)+SUM(四月)+SUM(五月)+SUM(六月)+SUM(七月)+SUM(八月)+SUM(九月)+SUM(十月)+SUM(十一月)+SUM(十二月)
FROM #TALL
WHERE Item='新品'
GROUP BY Item

SET @SumNewQ1=@SumNew1+@SumNew2+@SumNew3
SET @SumNewQ2=@SumNew4+@SumNew5+@SumNew6
SET @SumNewQ3=@SumNew7+@SumNew8+@SumNew9
SET @SumNewQ4=@SumNew10+@SumNew11+@SumNew12
---保存每月新品汇总值
SELECT 
@SumAll1=SUM(一月),@SumAll2=SUM(二月), @SumAll3=SUM(三月), @SumAll4=SUM(四月), @SumAll5=SUM(五月), @SumAll6=SUM(六月),
@SumAll7=SUM(七月),@SumAll8=SUM(八月), @SumAll9=SUM(九月), @SumAll10=SUM(十月), @SumAll11=SUM(十一月), @SumAll12=SUM(十二月),
@SumAllTotal=SUM(一月)+SUM(二月)+SUM(三月)+SUM(四月)+SUM(五月)+SUM(六月)+SUM(七月)+SUM(八月)+SUM(九月)+SUM(十月)+SUM(十一月)+SUM(十二月)
FROM #TALL

SET @SumAllQ1=@SumAll1+@SumAll2+@SumAll3
SET @SumAllQ2=@SumAll4+@SumAll5+@SumAll6
SET @SumAllQ3=@SumAll7+@SumAll8+@SumAll9
SET @SumAllQ4=@SumAll10+@SumAll11+@SumAll12

SELECT 
M.系列,
M.一月,CAST(M.一月占比*100 AS DECIMAL(18,2)) AS 一月占比,
M.二月,CAST(M.二月占比*100 AS DECIMAL(18,2)) AS 二月占比,
M.三月,CAST(M.三月占比*100 AS DECIMAL(18,2)) AS 三月占比,
M.四月,CAST(M.四月占比*100 AS DECIMAL(18,2)) AS 四月占比,
M.五月,CAST(M.五月占比*100 AS DECIMAL(18,2)) AS 五月占比,
M.六月,CAST(M.六月占比*100 AS DECIMAL(18,2)) AS 六月占比,
M.七月,CAST(M.七月占比*100 AS DECIMAL(18,2)) AS 七月占比,
M.八月,CAST(M.八月占比*100 AS DECIMAL(18,2)) AS 八月占比,
M.九月,CAST(M.九月占比*100 AS DECIMAL(18,2)) AS 九月占比,
M.十月,CAST(M.十月占比*100 AS DECIMAL(18,2)) AS 十月占比,
M.十一月,CAST(M.十一月占比*100 AS DECIMAL(18,2)) AS 十一月占比,
M.十二月,CAST(M.十二月占比*100 AS DECIMAL(18,2)) AS 十二月占比,
M.合计


FROM (
-----------按月度计算比例----------------
SELECT Item,系列,
一月,IIF(@SumNew1=0,0,一月/@SumNew1) AS 一月占比,二月,IIF(@SumNew2=0,0,二月/@SumNew2)  AS 二月占比,三月,IIF(@SumNew3=0,0,三月/@SumNew3)  AS 三月占比,
四月,IIF(@SumNew4=0,0,四月/@SumNew4)  AS 四月占比,五月,IIF(@SumNew5=0,0,五月/@SumNew5)  AS 五月占比,六月,IIF(@SumNew6=0,0,六月/@SumNew6)  AS 六月占比,
七月,IIF(@SumNew7=0,0,七月/@SumNew7)  AS 七月占比,八月,IIF(@SumNew8=0,0,八月/@SumNew8)  AS 八月占比,九月,IIF(@SumNew9=0,0,九月/@SumNew9)  AS 九月占比,
十月,IIF(@SumNew10=0,0,十月/@SumNew10)  AS 十月占比,十一月,IIF(@SumNew11=0,0,十一月/@SumNew11)  AS 十一月占比,十二月,IIF(@SumNew12=0,0,十二月/@SumNew12)  AS 十二月占比,
一月+二月+三月+四月+五月+六月+七月+八月+九月+十月+十一月+十二月 AS 合计
FROM #TALL
where Item='新品'

UNION ALL --旧品合计
SELECT '旧品','旧品当月合计',
@SumOld1,IIF(@SumAll1=0,0,@SumOld1/@SumAll1),
@SumOld2,IIF(@SumAll2=0,0,@SumOld2/@SumAll2),
@SumOld3,IIF(@SumAll3=0,0,@SumOld3/@SumAll3),
@SumOld4,IIF(@SumAll4=0,0,@SumOld4/@SumAll4),
@SumOld5,IIF(@SumAll5=0,0,@SumOld5/@SumAll5),
@SumOld6,IIF(@SumAll6=0,0,@SumOld6/@SumAll6),
@SumOld7,IIF(@SumAll7=0,0,@SumOld7/@SumAll7),
@SumOld8,IIF(@SumAll8=0,0,@SumOld8/@SumAll8),
@SumOld9,IIF(@SumAll9=0,0,@SumOld9/@SumAll9),
@SumOld10,IIF(@SumAll10=0,0,@SumOld10/@SumAll10),
@SumOld11,IIF(@SumAll11=0,0,@SumOld11/@SumAll11),
@SumOld12,IIF(@SumAll12=0,0,@SumOld12/@SumAll12),
@SumOld1+@SumOld2+@SumOld3+@SumOld4+@SumOld5+@SumOld6+@SumOld7+@SumOld8+@SumOld9+@SumOld10+@SumOld11+@SumOld12

UNION ALL --新品合计
SELECT '新品','新品当月合计',
@SumNew1,IIF(@SumAll1=0,0,@SumNew1/@SumAll1),
@SumNew2,IIF(@SumAll2=0,0,@SumNew2/@SumAll2),
@SumNew3,IIF(@SumAll3=0,0,@SumNew3/@SumAll3),
@SumNew4,IIF(@SumAll4=0,0,@SumNew4/@SumAll4),
@SumNew5,IIF(@SumAll5=0,0,@SumNew5/@SumAll5),
@SumNew6,IIF(@SumAll6=0,0,@SumNew6/@SumAll6),
@SumNew7,IIF(@SumAll7=0,0,@SumNew7/@SumAll7),
@SumNew8,IIF(@SumAll8=0,0,@SumNew8/@SumAll8),
@SumNew9,IIF(@SumAll9=0,0,@SumNew9/@SumAll9),
@SumNew10,IIF(@SumAll10=0,0,@SumNew10/@SumAll10),
@SumNew11,IIF(@SumAll11=0,0,@SumNew11/@SumAll11),
@SumNew12,IIF(@SumAll12=0,0,@SumNew12/@SumAll12),
@SumNew1+@SumNew2+@SumNew3+@SumNew4+@SumNew5+@SumNew6+@SumNew7+@SumNew8+@SumNew9+@SumNew10+@SumNew11+@SumNew12

UNION ALL --总计
SELECT '总计','总计',
@SumAll1,1,
@SumAll2,1,
@SumAll3,1,
@SumAll4,1,
@SumAll5,1,
@SumAll6,1,
@SumAll7,1,
@SumAll8,1,
@SumAll9,1,
@SumAll10,1,
@SumAll11,1,
@SumAll12,1,
@SumAll1+@SumAll2+@SumAll3+@SumAll4+@SumAll5+@SumAll6+@SumAll7+@SumAll8+@SumAll9+@SumAll10+@SumAll11+@SumAll12

UNION ALL --新品占比
SELECT '新品占比','新品本年累计',
@SumNew1,IIF(@SumAllTotal=0,0,@SumNew1/@SumAllTotal),
@SumNew2,IIF(@SumAllTotal=0,0,@SumNew2/@SumAllTotal ),
@SumNew3,IIF(@SumAllTotal=0,0,@SumNew3/@SumAllTotal ),
@SumNew4,IIF(@SumAllTotal=0,0,@SumNew4/@SumAllTotal ),
@SumNew5,IIF(@SumAllTotal=0,0,@SumNew5/@SumAllTotal ),
@SumNew6,IIF(@SumAllTotal=0,0,@SumNew6/@SumAllTotal ),
@SumNew7,IIF(@SumAllTotal=0,0,@SumNew7/@SumAllTotal ),
@SumNew8,IIF(@SumAllTotal=0,0,@SumNew8/@SumAllTotal ),
@SumNew9,IIF(@SumAllTotal=0,0,@SumNew9/@SumAllTotal ),
@SumNew10,IIF(@SumAllTotal=0,0,@SumNew10/@SumAllTotal ),
@SumNew11,IIF(@SumAllTotal=0,0,@SumNew11/@SumAllTotal ),
@SumNew12,IIF(@SumAllTotal=0,0,@SumNew12/@SumAllTotal ),
@SumAllTotal
) M


/*
UNION ALL --新品占比
SELECT '新品占比','新品当月占比',
IIF(@SumAll1=0,0,@SumNew1/@SumAll1),
IIF(@SumAll2=0,0,@SumNew2/@SumAll2),
IIF(@SumAll3=0,0,@SumNew3/@SumAll3),
IIF(@SumAll4=0,0,@SumNew4/@SumAll4),
IIF(@SumAll5=0,0,@SumNew5/@SumAll5),
IIF(@SumAll6=0,0,@SumNew6/@SumAll6),
IIF(@SumAll7=0,0,@SumNew7/@SumAll7),
IIF(@SumAll8=0,0,@SumNew8/@SumAll8),
IIF(@SumAll9=0,0,@SumNew9/@SumAll9),
IIF(@SumAll10=0,0,@SumNew10/@SumAll10),
IIF(@SumAll11=0,0,@SumNew11/@SumAll11),
IIF(@SumAll2=0,0,@SumNew12/@SumAll2),
IIF(@SumAllTotal=0,0,@SumAllTotal/@SumAllTotal)


*/
-----------按季度计算比例----------------
SELECT Q.系列,Q.第一季度,
CAST(Q.第一季度占比*100 AS DECIMAL(18,2)) AS 第一季度占比,
Q.第二季度,
CAST(Q.第二季度占比*100 AS DECIMAL(18,2)) AS 第二季度占比,
Q.第三季度,
CAST(Q.第三季度占比*100 AS DECIMAL(18,2)) AS 第三季度占比,
Q.第四季度,
CAST(Q.第四季度占比*100 AS DECIMAL(18,2)) AS 第四季度占比,
Q.合计 FROM (

SELECT Item,系列,
一月+二月+三月 第一季度,IIF(@SumNewQ1=0,0,(一月+二月+三月)/@SumNewQ1) AS 第一季度占比,
四月+五月+六月 第二季度,IIF(@SumNewQ2=0,0,(四月+五月+六月)/@SumNewQ2) AS 第二季度占比,
七月+八月+九月 第三季度,IIF(@SumNewQ3=0,0,(七月+八月+九月)/@SumNewQ3) AS 第三季度占比,
十月+十一月+十二月 第四季度,IIF(@SumNewQ4=0,0,(十月+十一月+十二月)/@SumNewQ4) AS 第四季度占比,
一月+二月+三月+四月+五月+六月+七月+八月+九月+十月+十一月+十二月 AS 合计
FROM #TALL
where Item='新品'

UNION ALL --旧品合计
SELECT '旧品','旧品本季度合计',
@SumOldQ1,IIF(@SumAllQ1=0,0,@SumOldQ1/@SumAllQ1),
@SumOldQ2,IIF(@SumAllQ2=0,0,@SumOldQ2/@SumAllQ2),
@SumOldQ3,IIF(@SumAllQ3=0,0,@SumOldQ3/@SumAllQ3),
@SumOldQ4,IIF(@SumAllQ4=0,0,@SumOldQ4/@SumAllQ4),
@SumOldQ1+@SumOldQ2+@SumOldQ3+@SumOldQ4

UNION ALL --新品合计
SELECT '新品','新品本季度合计',
@SumNewQ1,IIF(@SumAllQ1=0,0,@SumNewQ1/@SumAllQ1),
@SumNewQ2,IIF(@SumAllQ2=0,0,@SumNewQ2/@SumAllQ2),
@SumNewQ3,IIF(@SumAllQ3=0,0,@SumNewQ3/@SumAllQ3),
@SumNewQ4,IIF(@SumAllQ4=0,0,@SumNewQ4/@SumAllQ4),
@SumNewQ1+@SumNewQ2+@SumNewQ3+@SumNewQ4

UNION ALL --总计
SELECT '总计','总计',
@SumAllQ1,1,
@SumAllQ2,1,
@SumAllQ3,1,
@SumAllQ4,1,
@SumAllTotal

UNION ALL --新品占比
SELECT '新品占比','新品本年累计',
@SumNewQ1,IIF(@SumAllTotal=0,0,CAST(@SumNewQ1/@SumAllTotal AS DECIMAL(18,2))),
@SumNewQ2,IIF(@SumAllTotal=0,0,CAST(@SumNewQ2/@SumAllTotal AS DECIMAL(18,2))),
@SumNewQ3,IIF(@SumAllTotal=0,0,CAST(@SumNewQ3/@SumAllTotal AS DECIMAL(18,2))),
@SumNewQ4,IIF(@SumAllTotal=0,0,CAST(@SumNewQ4/@SumAllTotal AS DECIMAL(18,2))),
@SumAllTotal
) Q
END


报表展示:
在这里插入图片描述

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 鲸 设计师: meimeiellie
应支付99.00元
点击重新获取
扫码支付

支付成功即可阅读