日期:2014-05-18 浏览次数:20652 次
create table friends(person varchar(5),friend varchar(5)); insert friends select 'A','B' union all select 'B','A' union all select 'B','C' union all select 'C','B' select * from (select f1.person as f1person,f1.friend as f1friend,f2.friend as f2friend from friends f1,friends f2 where f1.friend = f2.person) t1 where t1.f1person != t1.f2friend ;