1)
select *
from tab t
where exists (select 1 from tab where id = t.id and (name <> t.name or age <> t.age)
2)
select *
from tab
where id in (select id from tab group by id having count(*) > 1)
Oracle 如何查询出一个表中相同的数据
最新推荐文章于 2023-03-07 11:28:15 发布
1)
select *
from tab t
where exists (select 1 from tab where id = t.id and (name <> t.name or age <> t.age)
2)
select *
from tab
where id in (select id from tab group by id having count(*) > 1)