CREATE PROCEDURE cw_ywhzb @ ldt_sdate datetime,
@ ldt_edate datetime,
@ ls_lx varchar (1)
AS
The BEGIN
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- classification summary part -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
If @ ls_lx='1'
The begin
SELECT (SELECT fymc from jc_fylbzd where fybh=jc_fyzd. Lsfybh) as fymc,
The sum (zje) as je
The FROM jc_fylbzd,
Jc_fyzd,
Mz_fpdj,
Mz_cfmx
The WHERE (mz_fpdj. FPH=mz_cfmx. FPH) and
(jc_fylbzd. Fybh=mz_cfmx. Fygl) and
(jc_fylbzd. Fybh=jc_fyzd. Fybh) and
((jc_fyzd LBBH='1') and
(SFSJ & gt;=@ ldt_sdate and
SFSJ & lt;=@ ldt_edate))
GROUP BY jc_fyzd. Lsfybh
Return
End
If @ ls_lx='2'
The begin
SELECT (SELECT fymc from jc_fylbzd where fybh=jc_fyzd. Lsfybh) as fymc,
The sum (zje) as je
The FROM jc_fylbzd,
Jc_fyzd,
Zy_cfdj,
Zy_cfmx
The WHERE (zy_cfdj. CFH=zy_cfmx. CFH) and
(jc_fylbzd. Fybh=zy_cfmx. Fygl) and
(jc_fylbzd. Fybh=jc_fyzd. Fybh) and
((jc_fyzd LBBH='2') and
(HJSJ & gt;=@ ldt_sdate and
HJSJ & lt;=@ ldt_edate))
GROUP BY jc_fyzd. Lsfybh
Return
End
Return
END
GO
CodePudding user response:
Pick up points first!CodePudding user response:
Pay attention to pick up points