update zy_yp1_yfzk set cfbj='T' where left(htbh,1)='6' and cfbj='F'--一定要换程序
CREATE VIEW dbo.zy_view_groupjsdjh
AS
SELECT jsdjh, SUM(jsdj * kl * bzsl - bzdj * kl * bzsl) AS ml
FROM dbo.ZY_YP1_SFMX
WHERE (cfbj = 'f')
GROUP BY jsdjh
select
kpsj,
dw,
(select dmmc from zy_sys2_cgdw d where d.dm=a.dw) as dwmc,
htbh,
kpje,
(select c.ml from zy_view_groupjsdjh c where c.jsdjh=a.htbh) as ml,
(select e.dmmc from zy_yp1_htmain b,zy_sys2_ygbm e where a.htbh=b.htbh and b.cfbj='f' and e.dm=b.xfqdr and b.czrq>=:ls_date1 and b.czrq<=:ls_date2) as ywy,
yjze,
kpje*0.03 as fy,
kpje*0.17 as fy2
from
zy_yp1_yfzk a where a.cfbj='f' and a.kpsj>=:ls_date1 and a.kpsj<=ls_date2
CREATE VIEW dbo.zy_view_groupjsdjh
AS
SELECT jsdjh, SUM(jsdj * kl * bzsl - bzdj * kl * bzsl) AS ml
FROM dbo.ZY_YP1_SFMX
WHERE (cfbj = 'f')
GROUP BY jsdjh
select
kpsj,
dw,
(select dmmc from zy_sys2_cgdw d where d.dm=a.dw) as dwmc,
htbh,
kpje,
(select c.ml from zy_view_groupjsdjh c where c.jsdjh=a.htbh) as ml,
(select e.dmmc from zy_yp1_htmain b,zy_sys2_ygbm e where a.htbh=b.htbh and b.cfbj='f' and e.dm=b.xfqdr and b.czrq>=:ls_date1 and b.czrq<=:ls_date2) as ywy,
yjze,
kpje*0.03 as fy,
kpje*0.17 as fy2
from
zy_yp1_yfzk a where a.cfbj='f' and a.kpsj>=:ls_date1 and a.kpsj<=ls_date2