写一条SQL语句,统计表中a、b两列值相同的数量,将大于1的记录打印出来。

如图,基于一张表(test01)筛选有相同数据的指定的列(a、b)。
select * from test01 t where (
select count(1) from test01 where a = t.a and b = t.b
)>1
结果:

上士闻道,勤而行之!

如图,基于一张表(test01)筛选有相同数据的指定的列(a、b)。
select * from test01 t where (
select count(1) from test01 where a = t.a and b = t.b
)>1
结果:
