select * from table where id in
(select id from table group by id having count(*)>1 )
order by id

解决方案 »

  1.   

    select yourcol1,yourcol2 from yourtable group by yourcol1,yourcol2 having count(*) > 1
      

  2.   

    select xh from tablename group by xh having count(*)>=2
    最好在提交按钮里包含一个检查功能。在后台数据库上,建唯一索引,然后提交时,出现重复行,必然出错。根据出错,进行提示。这样唯一性更能保证。
      

  3.   

    多谢sky_blue.
    还有一个问题,在我修改重复行的数据时
    系统提示:键列信息不足或不正确。更新影响到过多的行。
    我FAINT了快!help again!
      

  4.   

    你在MMC中删除时,因为它要去找能确定你要删除的记录的条件,就象
    delect table where aa=xx and bb=YY
    但是这个条件在表中有两条记录,所以系统认为你的条件不充分,所以它不知道应该把两条中的哪一条删除,所以出现上面的提示。
    TRY:
    select * into #temp from table where ........  --条件选出那两条
    delete table where.......insert into table 
       select top1 * from #temp
      

  5.   

    任何表必须包含主键,用recordset修改的时,打开的recordset也必须包含主键。
      

  6.   

    table中给她建个Key值,把这个问题杀死在脑子里!!嘿嘿。。