就是说,想要过滤掉某字段中一些没有重复的记录,要怎么写?比如A字段中有记录,1,1,2,2,3,4,5,5,6,6,过滤后就成为了1,1,2,2,5,5,6,6,或者1,2,5,6也可以。谢谢
參考答案:假设表名为t_test,
显示为1,2,5,6:
select a
from t_test
group a
having count(*)>1
如果要显示为1,1,2,2,5,5,6,6,速度可能会慢些
select a
from t_test
where a in ( select a
from t_test
group by a
having count(*)>1
)