select ttt.biaoti from (select yj.idd,yj.yjts,yj.C_SCJL from cz_pgsc_zskwh_cld t, (select t3.id idd, count(jl.id) / 3 yjts, jl.C_SCJL C_SCJL from cz_pgsc_zskwh_cld t3, cz_pgsc_jl jl where t3.id = jl.cld_id and jl.c_scjl is not null and (jl.JLXZ = '1' or jl. JLXZ = '2') group by t3.id, jl.C_SCJL) yj where t.id = yj.idd) tt left join (select czhyxx.pgcldId, czhyxx.spsj,czhyxx.hycs,czhyxx.yjnr,czhyxx.yjnr,czhyxx.bianhao from cz_pgsc_zskwh_cld t, (select t2.id pgcldId, to_char(hy.spsj, 'yyyy-MM-dd') spsj, lsb.spjl spjl, hy.hycs hycs, op.yjnr yjnr, t2.bianhao bianhao from cz_pgsc_zskwh_cld t2, common_according acc, cz_xmxx_lsb lsb, CZ_HYXX hy, p_t_common_opinion op where t2.id = acc.tbdid and acc.lcmc = '评估审查' and acc.bdid = lsb.cld_id and op.bdid = lsb.id and lsb.hy_id = hy.id and op.yjylx = '17') czhyxx where t.id = czhyxx.pgcldId) ttt on tt.idd = ttt.pgcldId 这样 也不对
你这个 biaoti 字段 得在 left join 右边或左边的表(子查询)中出现啊。你看你的有吗?
能不能排版排好了再发一下sql,比如这个括号对一下看得都不知道哪个括号是哪个的。。
and (jl.JLXZ = '1' or jl. JLXZ = '2') jl. jlxz中间多了个空格不知道是不是这原因,
from cz_pgsc_zskwh_cld t,
(select t3.id idd, count(jl.id) / 3 yjts, jl.C_SCJL C_SCJL
from cz_pgsc_zskwh_cld t3, cz_pgsc_jl jl
where t3.id = jl.cld_id
and jl.c_scjl is not null
and (jl.JLXZ = '1' or jl. JLXZ = '2')
group by t3.id, jl.C_SCJL) yj
where t.id = yj.idd) tt
left join (select czhyxx.pgcldId, czhyxx.spsj,czhyxx.hycs,czhyxx.yjnr,czhyxx.yjnr,czhyxx.bianhao
from cz_pgsc_zskwh_cld t,
(select t2.id pgcldId,
to_char(hy.spsj, 'yyyy-MM-dd') spsj,
lsb.spjl spjl,
hy.hycs hycs,
op.yjnr yjnr,
t2.bianhao bianhao
from cz_pgsc_zskwh_cld t2,
common_according acc,
cz_xmxx_lsb lsb,
CZ_HYXX hy,
p_t_common_opinion op
where t2.id = acc.tbdid
and acc.lcmc = '评估审查'
and acc.bdid = lsb.cld_id
and op.bdid = lsb.id
and lsb.hy_id = hy.id
and op.yjylx = '17') czhyxx
where t.id = czhyxx.pgcldId) ttt
on tt.idd = ttt.pgcldId
这样 也不对
and (jl.JLXZ = '1' or jl. JLXZ = '2') jl. jlxz中间多了个空格不知道是不是这原因,