读书人

oracle sql 搜寻数据重复

发布时间: 2012-09-16 17:33:17 作者: rapoo

oracle sql 搜索数据重复
[code=SQL][/code]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,所以结果会重复,两表没有关联.

[解决办法]

SQL code
--这样就不会有重复了select a.* from wcm_site awhere 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; 

读书人网 >oracle

热点推荐