Say that I have two tables T and T1
T
id p o
1 47 1
2 48 2
3 49 25
T1
id p o
1 47 1
2 42 2
3 47 25
I am looking to insert rows from T1 into T if count(T1.p)>1
T
id p o
1 47 1
2 48 2
3 49 25
1 47 1
3 47 25
I tried the following query but it didn't work
insert into T(id , p,o)(SELECT T1.id , T1.p1,T1.l FROM T1
where SELECT count(*) FROM t1
GROUP BY t1.p
HAVING COUNT(*)>1)
For more details . Any help will be appreciated .