请教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去掉,否则会多出一堆记录