with m1 as( select a.XZQYBM, count(distinct b.HZBM) as hz_num, count(c.IDNUMBER) as rk_num from XZQY a, HZXX b, RKXX c where a.XZQYBM = b.XZQYBM and b.HZBM = c.HZBM group by a.XZQYBM) select d.*, m1.hz_num, m1.rk_num from m1, XZQY d where m1.XZQYBM = d.XZQYBM;祝LZ好运
select a.SHENG, a.SHI, a.xian , a.xiang, a.cun, count(b.hzbm) as total_hz, count(b.xzqbm) as total_idnumber from t_tablA a,t_tablB b,t_tablC c where a.xzqbm = b.xzqbm and b.hzbm =c.hzbm group by a.sheng, --a.shi as '市', a.xian, a.xiang, a.cun 代码献上,祝你好运!
select a.XZQYBM, count(distinct b.HZBM) as hz_num, count(c.IDNUMBER) as rk_num
from XZQY a, HZXX b, RKXX c
where a.XZQYBM = b.XZQYBM
and b.HZBM = c.HZBM
group by a.XZQYBM)
select d.*, m1.hz_num, m1.rk_num from m1, XZQY d where m1.XZQYBM = d.XZQYBM;祝LZ好运
a.SHI,
a.xian ,
a.xiang,
a.cun,
count(b.hzbm) as total_hz,
count(b.xzqbm) as total_idnumber
from t_tablA a,t_tablB b,t_tablC c
where a.xzqbm = b.xzqbm and
b.hzbm =c.hzbm
group by a.sheng,
--a.shi as '市',
a.xian,
a.xiang,
a.cun
代码献上,祝你好运!