看看我的sql语句那里错了,谢谢(30分)

  • 主题发起人 主题发起人 lgzh_3
  • 开始时间 开始时间
L

lgzh_3

Unregistered / Unconfirmed
GUEST, unregistred user!
select n.fzr,n.zpzs,n,clzs,n.zjl,m.clsl,m.dqsl,m.nsl
from
(select c.fzr as fzr,iif(c.zpzs is null,0,c.zpzs) as zpzs,
iif(d.cls is null,0,d.cls) as clzs,
iif(zpzs=0,100,clzs*100/zpzs) as zjl
from
(select clxx.fzr,count(clxx.clhp) as zpzs from clxx,zpxx where clxx.clhp=zpxx.cph group by clxx.fzr) c left join
(select clxx.fzr,count(clxx.clhp) as cls from clxx,zpxx where clxx.clhp=zpxx.cph and zpxx.sfcl='是' group by clxx.fzr) d
on c.fzr=d.fzr) n,
(select a.fzr as fzr,iif(a.clsl is null,0,a.clsl) as clsl,
iif(b.dqsl is null,0,b.dqsl) as dqsl,
iif(clsl-0,100,(a.clsl-b.dqsl)*100/a.clsl) as nsl
from
(select fzr,count(*) as clsl from clxx group by fzr) a,
(select fzr,count(*) as dqsl from clxx where nsrq<now() group by fzr) b
where a.fzr=b.fzr) m
where n.fzr=m.fzr;
 
select n.fzr,n.zpzs,n,clzs,n.zjl,m.clsl,m.dqsl,m.nsl
n.clzs
 
谢谢,给你了哥们,我看了老多遍没有看出来,你看看能不能简化一下呢,
分先给了
 
后退
顶部