By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t1(adm int, ref int)
insert into t1 values(102,2145),(102,2145),(103,2152),(104,2152)
select * from t1 a
where exists
(select 1 from t1 b where a.ref=b.ref having count(distinct adm)>1)
adm | ref |
---|---|
103 | 2152 |
104 | 2152 |