请教一个聚合查询的问题

来源:百度知道 编辑:UC知道 时间:2024/06/25 01:36:33
dim bk,bks,sup,sups,mesgp,pay,pamt,ors,odt

set bk=coon.execute("select count(approbate) as bks from books where approbate=0")'分析books数量
bks=bk("bks")
bk.close
set bk=nothing

set sup=coon.execute("select count(estates) as sups from support where estates < 8")'分析support数量
if sup("sups") > 0 then
sups=sup("sups")
end if
sup.close
set sup=nothing

set pay=coon.execute("select count(pay_estates) as pamt from payment where pay_estates =0")'分析payment数量
if pay("pamt") > 0 then
pamt=pay("pamt")
end if
pay.close
set pay=nothing

set ors=coon.execute("select count(manage) as odt from order_form where manage=0")'分析order_form数量
if ors("odt") > 0 then
odt=ors("odt")
end if
ors.close
set ors=nothing

dim urs,udt
set urs=

select bks+sups+pamt+odt+udt
(select count(approbate) as bks from books where approbate=0) a,
(select count(estates) as sups from support where estates < 8) b,
(select count(pay_estates) as pamt from payment where pay_estates =0) c,
(select count(manage) as odt from order_form where manage=0) d,
(select count(shp_manage) as udt from usre_shops where shp_manage=1) e

select count(approbate) as sl from books where approbate=0
union
select count(estates) as sl from support where estates < 8
union
select count(pay_estates) as sl from payment where pay_estates =0
union
select count(manage) as sl from order_form where manage=0