- 爱易网页
-
Oracle教程
- oracle数据库中多张表进行查询需要注意什么有关问题?为什么查不到小弟我想要的值
日期:2014-05-17 浏览次数:20777 次
oracle数据库中多张表进行查询需要注意什么问题??为什么查不到我想要的值
我在数据库中进行七张表的关联查询,where后的条件有12个,其中很多表都不直接关联,现在查询不到我想要的数据,请问各位高手,当多张表进行关联的时候,应该注意哪些问题呢,where后的查询条件是不是有什么先后顺序???
select
GI.GUARANTYID as GUARANTYID,
GI.GUARANTYTYPE as GUARANTYTYPE,
case
when GI.GUARANTYTYPE like '2010%' then '020'
when GI.GUARANTYTYPE like '2020%' then '030'
when GI.GUARANTYTYPE like '1010%' then '040'
when GI.GUARANTYTYPE like '1020%' then '050'
else '070' end as CLASSIFY,
GI.CONFIRMVALUE as CONFIRMVALUE,
BD.BUSINESSTYPE as BUSINESSTYPE,
BD.SERIALNO as BUSINESSSERIALNO,
BD.BALANCE as BUSINESSBALANCE,
GC.SERIALNO as GUARANTYCONTRACTID,
'2011/09/20' as SESSIONID
from BUSINESS_DUEBILL BD,
BUSINESS_CONTRACT BC,
GUARANTY_CONTRACT GC,
lmt_tree_node LMT,
AGR_CRE_SEC_RELA AGR,
GUARANTY_INFO GI, GUARANTY_RELATIVE GR
where
GI.guarantyId =GR.guarantyId
and GR.GCCONTRACTNO =GC.serialNo
and GC.serialNo=BC.RELATIVESERIALNO
and GC.serialNo= AGR.GUR_SERIALNO