create table push(id int primary key ,a1 int ,a2 int,a3 int)
insert into push values(1,2,3,4)
insert into push values(2,1,2,3)
insert into push values(3,1,2,3)
create table history(id int primary key ,a1 int ,a2 int,a3 int)
insert into history values(1,2,3,4)
insert into history values(2,1,2,3)
insert into history values(3,2,3,4)
insert into history values(4,1,2,2)
select A.* from
push A
inner join
(select a1, a2, a3 from history group by a1, a2, a3 having count(*)>1) B
on A.a1=B.a1 and A.a2=B.a2 and A.a3=B.a3
select p.a1,p.a2,p.a3 from push p where exists (select h.a1,h.a2,h.a3 from history h where h.a1=p.a1 and h.a2=p.a2 and h.a3=p.a3 group by h.a1,h.a2,h.a3 having count(*)>=2)
select A.* from
(select a1, a2, a3 from push group by a1, a2, a3 having count(*)>1) A
inner join
(select a1, a2, a3 from history group by a1, a2, a3 having count(*)>1) B
on A.a1=B.a1 and A.a2=B.a2 and A.a3=B.a3
Select * from
(Select * from push Where Exists(Select * from history Where a1=push.a1 And a2=push.a2 And a3=push.a3 Having Count(*)>2) ) A
Inner Join history B
On A.a1=B.a1 And A.a2=B.a2 And A.a3=B.a3