INSERT INTO xsyb
( months,
spbm,
xlbm,
ghsbm,
xssl,
xsje,
xsml,
zxdbm )
SELECT dpxstjb.spbm,
spb.xlbm,
spb.ghsbm,
(select sum(A.xssl) from dpxstjb A where dpxstjb.spbm = A.spbm and dpxstjb.rq = A.rq),
(select sum(B.xszj) from dpxstjb B where dpxstjb.spbm = B.spbm and dpxstjb.rq = B.rq),
(select sum(C.xssl - C.jqjj * C.xssl) from dpxstjb C where dpxstjb.spbm = C.spbm and dpxstjb.rq = C.rq)
FROM dpxstjb,
spb
WHERE dpxstjb.spbm = spb.spbm and
dpxstjb.rq >= :ybstart AND
dpxstjb.rq <= :ybend
;
( months,
spbm,
xlbm,
ghsbm,
xssl,
xsje,
xsml,
zxdbm )
SELECT dpxstjb.spbm,
spb.xlbm,
spb.ghsbm,
(select sum(A.xssl) from dpxstjb A where dpxstjb.spbm = A.spbm and dpxstjb.rq = A.rq),
(select sum(B.xszj) from dpxstjb B where dpxstjb.spbm = B.spbm and dpxstjb.rq = B.rq),
(select sum(C.xssl - C.jqjj * C.xssl) from dpxstjb C where dpxstjb.spbm = C.spbm and dpxstjb.rq = C.rq)
FROM dpxstjb,
spb
WHERE dpxstjb.spbm = spb.spbm and
dpxstjb.rq >= :ybstart AND
dpxstjb.rq <= :ybend
;
where 后跟表dpxstjb的关键字即可
( months,
spbm,
xlbm,
ghsbm,
xssl,
xsje,
xsml,
zxdbm )
SELECT 常数 as months,
dpxstjb.spbm,
spb.xlbm,
spb.ghsbm,
sum(dpxstjb.xssl),
sum(dpxstjb.xszj),
sum(dpxstjb.xszj - dpxstjb.jqjj*dpxstjb.xssl)
FROM dpxstjb,
spb
WHERE ( dpxstjb.spbm = spb.spbm ) and
( ( dpxstjb.rq >= :ybstart ) AND
( dpxstjb.rq <= :ybend ) )
select 常数 as x,y,z from b
where ....这里 y,z 从 b表取数,X设置未常数
user_purview,user_password)
SELECT :ls_user,purview_order,purview_type,purview_name,0,:ls_pass FROM purview_code;