SELECT [K_clrk_D].[CLBH] AS CLBH, [K_clrk_M].[KDRQ] AS KDRQ, [K_clrk_M].[DHDH] AS DHDH, [K_clrk_D].[SLSL] AS SLSL, [SLSL]*[K_clrk_D].[DJDJ] AS JEJE
FROM K_clrk_M INNER JOIN K_clrk_D ON [K_clrk_M].[DHDH]=[K_clrk_D].[DHDH]
WHERE [K_clrk_m].[STATUS]=1;
SELECT A.CLBH, Sum(A.SLSL) AS ZSL, Sum(A.JEJE) AS ZJE, year([KDRQ]) & "-" & Month([KDRQ]) & "-" & "1" AS MON
FROM SFC_rk AS A
GROUP BY A.CLBH, year([KDRQ]) & "-" & Month([KDRQ]) & "-" & "1";
SELECT A.CLBH, Sum(IIf(ISNULL(A.SLSL),0,A.SLSL)) AS ZSL, Sum(IIf(ISNULL(A.JEJE),0,A.JEJE)) AS ZJE, year([KDRQ]) & "-" & Month([KDRQ]) & "-" & "1" AS MON
FROM SFC_ck AS A
GROUP BY A.CLBH, year([KDRQ]) & "-" & Month([KDRQ]) & "-" & "1";
SELECT A.BHBH AS BHBH, A.YFYF AS YFYF, IIf(ISNULL(A.QCSL),0,A.QCSL) AS QCSL, IIf(ISNULL(B.ZSL),0,B.ZSL) AS SRSL, [QCSL]+SRSL AS MISL, IIf(ISNULL(A.QCJE),0,A.QCJE) AS QCJE, IIf(ISNULL(B.ZJE),0,B.ZJE) AS SRJE, [QCJE]+SRJE AS MIJE
FROM T_SFC_QC AS A LEFT JOIN SFC_RK_GP AS B ON (A.YFYF=CDATE(B.MON)) AND (A.BHBH=B.CLBH)
ORDER BY [bhbh];
SELECT A.BHBH, A.YFYF, A.QCSL, A.SRSL, A.MISL-IIF(ISNULL(B.ZSL),0,B.ZSL) AS QMSL, A.QCJE, A.SRJE, A.MIJE-IIF(ISNULL(B.ZJE),0,B.ZJE) AS QMJE, IIF(ISNULL(B.ZSL),0,B.ZSL) AS FCSL, IIF(ISNULL(B.ZJE),0,B.ZJE) AS FCJE
FROM SFC_AAA AS A LEFT JOIN SFC_CK_GP AS B ON (A.YFYF=CDATE(B.MON)) AND (A.BHBH=B.CLBH)
ORDER BY [bhbh];
SELECT A.BHBH, B.PMPM AS PMPM, B.GGGG AS GGGG, A.YFYF, A.QCSL, A.SRSL, A.FCSL, A.QMSL, A.QCJE, A.SRJE, A.FCJE, A.QMJE, B.FLAA, B.FLBB, B.FLCC
FROM SFC_BBB AS A LEFT JOIN J_clcl AS B ON A.BHBH=B.BHBH
ORDER BY A.BHBH;
SELECT SFC_CCC.*, IIf(ISNULL([O_Dzfy].[ZWZW]),"空",[O_Dzfy].[ZWZW]) AS ZWBB
FROM SFC_CCC LEFT JOIN O_Dzfy ON [O_Dzfy].[FHFH]=[SFC_CCC].[FLBB];
SELECT SFC_ZW_B.*, IIf(isnull([O_Dzfy].[ZWZW]),"空",[O_Dzfy].[ZWZW]) AS ZWCC
FROM SFC_ZW_B LEFT JOIN O_Dzfy ON [SFC_ZW_B].[FLCC]=[O_Dzfy].[FHFH];
SELECT A.FLBB AS FLBB, A.ZWBB AS ZWBB, A.ZWCC AS ZWCC, A.YFYF AS YFYF, Sum(A.QCSL) AS QCZSL, Sum(A.SRSL) AS SRZSL, Sum(A.FCSL) AS FCZSL, Sum(A.QMSL) AS QMZSL, Sum(A.QCJE) AS QCZJE, Sum(A.SRJE) AS SRZJE, Sum(A.FCJE) AS FCZJE, Sum(A.QMJE) AS QMZJE
FROM SFC_ZW_C AS A
GROUP BY A.FLBB, A.ZWBB, A.YFYF, A.ZWCC;
全月一次加权平均计算单价的部分代码:
sql 语句:
SELECT A.CLBH, SUM(A.SLSL) AS RKSL, SUM(A.JEJE) AS RKJE
FROM AVER_MTH_RK1 AS A
WHERE NOT (ISNULL(A.YFYF))
GROUP BY [CLBH];
SELECT A.CLBH, [SLSL], [JEJE], [YFYF]
FROM AVER_MTH_RK AS A LEFT JOIN T_SFC_QC AS B ON (A.CLBH=B.BHBH) AND (A.KDRQ>=B.YFYF);
SELECT A.DHDH, A.KDRQ, B.CLBH, B.SLSL, B.SLSL*B.DJDJ AS JEJE
FROM K_clrk_M AS A INNER JOIN K_clrk_D AS B ON A.DHDH=B.DHDH
WHERE STATUS=1;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页