sorry I can not type in Chinese, hope it won`t cause any problem ...assume that there is a tableatableNUM | key
-----------
a        1
a        1
b        2
b        3how can i get ride of the dumplicate rows
so that i could get a table like thisNUM | key
-----------
a        1
b        2
b        3

解决方案 »

  1.   

    过滤重复的列可以用distinct 关键字。如
    select
      distinct name
    from
      s_dept
      

  2.   

    如果想要得到记录可以
    select num,key from tablea group by num,key;
    如果想要找出重复的记录,可以
    select num,key from tablea group by num,key having count(*)>1;如果想要高效的删除重复记录,可以
    DELETE FROM tablea E WHERE E.ROWID > (SELECT MIN(X.ROWID) FROM tablea X WHERE X.num= E.num and x.key=e.key;