sql语句查询一个表中某一列的相同数据

1、找出这列中有相同内容的列的数据。代码如下:

select 列名 from 表名 group by 列名 having count(列名) > 1

2、把这些有相同内容的记录,查出来。代码如下:

select 列名 from 表名 where 列名 in (select 列名 from 表名 group by 列名 having count(列名) > 1)
posted on 2017-09-21 11:02  HubbertHu  阅读(34782)  评论(1编辑  收藏  举报