本帖最后由 SuperCustomer 于 2010-04-29 15:33:22 编辑

解决方案 »

  1.   

    select * from table1 t
    where not exists(
      select 1 from table1 where a=t.b and b=t.a and a>t.a)
      

  2.   

    with temp as( 
    select 1 a,2 b,'1,2' ab from dual
    union all
    select 2 a,1 b,'2,1' ab from dual
    )
    select * from temp where a = (round(dbms_random.value)+1)
      

  3.   

    引用一下狂浪的,改一下:
    delete from table1 t
    where exists(
      select 1 from tmp where a=t.b and b=t.a and a<t.a)
      

  4.   

      and  rownum=1 加个这个
    就选出一条了,
      

  5.   


    楼主的描述跟问题严重不符合啊!根据问题描述,去掉任意一行的话,delete from tb where rownum=1; 就好了。至于重复行记录去掉的,要看有几个字段,才好写sql语句,加入你表tb 有id主键、c1、c2、c3。那么重复的记录就是c1、c2、c3字段重复吧。
    那么删除重复行的sql就是
    delete from tb t2
    where exists(select 1 from tb t1 where t1.c1=t2.c1 and t1.c2=t2.c2 and t1.c3=t2.c3 and t1.id<>t2.id)
    这不就搞定了吗?
      

  6.   

    DELETE FROM tt a
     WHERE ROWID != (SELECT MAX(ROWID)
                       FROM tt b
                      WHERE (a.a = b.a AND a.b = b.b) OR
                            (a.a = b.b AND a.b = b.a));