当前位置: 代码迷 >> Oracle技术 >> oracle sql 搜索数据重复解决思路
  详细解决方案

oracle sql 搜索数据重复解决思路

热度:89   发布时间:2016-04-24 08:18:07.0
oracle sql 搜索数据重复
select a.* from wcm_site a,wcm_siteright b where (b.rightnote='AD025' or b.rightnote in ('1','3')) and a.id=b.siteid and a.id like '____' order by a.id;

因为一个wcm_site对应多个wcm_siteright,所以结果会重复,两表没有关联.
------解决方案--------------------

--这样就不会有重复了
select a.* from wcm_site a
where exists (select * from wcm_siteright b
where a.id=b.siteid and (b.rightnote='AD025' or b.rightnote in ('1','3')))
and a.id like '____' 
order by a.id;
  相关解决方案