17,377
社区成员
发帖
与我相关
我的任务
分享
select mp,decode(jydm in ('01','02','03','04','05','06'),-jyje,jyje) as je from table_a where mp='22365263';
select B.GSJGH,nvl(b.sfzh,b.jbxx_zjhm) as sfzh,b.bzjgmc,b.jbxx_sskhq,b.khxm, b.jbxx_xb,b.jbxx_nl,b.jbxx_khjb,c.WH_KHJLXM,a.jydm,a.jymc,a.cq,a.khrq,a.jyrq,a.dqrq,a.jyje,c.jd_dz from
(select a.*,b.*,c.* from
lsb_ls a,
hxb_and_hzb b,
jt_jbxxb c
where (case when b.jydm in('010203','010503','010606','020131','700204','020613')
then -b.jyje
else b.jyje
end)
where nvl(b.sfzh,b.jbxx_zjhm)=c.jd_zjhm(+) and nvl(b.sfzh,b.jbxx_zjhm)=a.sfzh(+)
and b.gsjgh='56234585'
and (substr(a.jysj,1,10)>='2017-04-15' and substr(a.jysj,1,10)<='2017-05-15')
and jymc is not null;
老是报 'where nvl(b.sfzh,b.jbxx_zjhm)=c.jd_zjhm(+) and nvl(b.sfzh,b.jbxx_zjhm)=a.sfzh(+) '无效的关系运算符
我就想关联三个表而已,斑竹帮我看看呗
select B.GSJGH,nvl(b.sfzh,b.jbxx_zjhm) as sfzh,b.bzjgmc,b.jbxx_sskhq,b.khxm, b.jbxx_xb,b.jbxx_nl,b.jbxx_khjb,c.WH_KHJLXM,a.jydm,a.jymc,a.cq,a.khrq,a.jyrq,a.dqrq,a.jyje,c.jd_dz from
(select a.*,b.*,c.* from
lsb_ls a,
hxb_and_hzb b,
jt_jbxxb c
where (case when b.jydm in('010203','010503','010606','020131','700204','020613')
then -b.jyje
else b.jyje
end)
where nvl(b.sfzh,b.jbxx_zjhm)=c.jd_zjhm(+) and nvl(b.sfzh,b.jbxx_zjhm)=a.sfzh(+)
and b.gsjgh='56234585'
and (substr(a.jysj,1,10)>='2017-04-15' and substr(a.jysj,1,10)<='2017-05-15')
and jymc is not null;
老是报 'where nvl(b.sfzh,b.jbxx_zjhm)=c.jd_zjhm(+) and nvl(b.sfzh,b.jbxx_zjhm)=a.sfzh(+) '无效的关系运算符
我就想关联三个表而已,斑竹帮我看看呗[/quote]
啥写法啊,外部select 没有from,子查询where 条件没看明白