Select * from 表 where a字段 in (select a字段 from 表 having count(*)>1 )

解决方案 »

  1.   

    Select * from tbl where a in
     (select a from tbl group by a
      having count(a)>1)
      

  2.   

    Select * from tbl where a in (select a from tbl group by a having count(*)>1)
      

  3.   

    select
        a
    from
        表
    group by 
        a
    having count(a)>1
      

  4.   

    insert into aa 
    SELECT 1 union all
    SELECT 1 union all
    SELECT 1 union all
    SELECT 2
    Select * from aa where ID in (select ID from aa group by ID having count(*)>1)(所影响的行数为 4 行)
    1
    1
    1
    1 SQL Server 啊 努力 奋斗-----------------------------------------------------
      

  5.   

    上面的少了Create
    Create Table aa(id int)
    insert into aa 
    SELECT 1 union all
    SELECT 1 union all
    SELECT 1 union all
    SELECT 2
    Select * from aa where ID in (select ID from aa group by ID having count(*)>1)(所影响的行数为 4 行)
    1
    1
    1
    1 SQL Server 啊 努力 奋斗-----------------------------------------------------