simple case will help you understand the power of intersectcreate table tb_inter(id int,name varchar(10),id2 int)insert into tb_interselect 10, 'AA', 12 union allselect 10, 'AA', 12 union allselect 10, 'AA1', 12 union allselect 11, 'AA1', 12 union allselect 11, 'AA2', 13 union allselect 11, 'AA2', 13select * from tb_interwhere id = 10 and id2 = 12select * from tb_interwhere id = 10intersectselect * from tb_interwhere id2 = 12select id, id2 from tb_interwhere id = 10intersectselect id, id2 from tb_interwhere id2 = 12