首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

请问SQL语句,请达人帮忙

2012-02-08 
请教SQL语句,请达人帮忙select......from...,ra,hawhere......and(ra.parentregionid14andra.idha.regio

请教SQL语句,请达人帮忙
select   ......
from   ...,ra,ha
where......
and   (ra.parentregionid=14   and   ra.id=ha.regionid)
or   (ha.regionid=ra.id   and   ra.parentregionid=rb.id   and   rb.parentregionid=14));  

select   ......
from   ...,ra,ha
where......
and   ha.regionid   in   (select   id   from   region   where   parentregionid=14)  
or   ha.regionid   in   (select   id   from   region   where   parentregionid   in   (select   id   from   region   where   parentregionid=14));
的结果为什么不同啊?
郁闷的很。
求教达人

[解决办法]
第二句用了子查询,在主查询里应该把ra去掉,否则会多出一堆记录

热点排行
Bad Request.