Oracle中交集 INTERSECT 的使用

intersect运算 
返回查询结果中相同的部分 
exp:查询两个人的共同好友,表 org_optor_friends 为好友表。
select friend_id from org_optor_friends f1 where f1.optor_id='ligp' and status='1'

intersect

select friend_id from org_optor_friends f2 where f2.optor_id='shangtao' and status='1'

猜你喜欢

转载自jiangjingxiaoxuan.iteye.com/blog/1402039