我现在有2条一模一样的数据
但是我现在想更新其中一条,那条都可以,但是只能一条
请大家帮忙

解决方案 »

  1.   

    请给例子
    where 条件怎么写法
      

  2.   

    update tbl t set a='1' where not exists(select 1 from tbl b where b.rowid>t.rowid and b.a=t.a and ...);
      

  3.   

    对哦我怎么没想到
    update tbl set a='1' where a='2' and b='2' and ... and rownum=1;
      

  4.   

    update t_weather
    set weather = 'changed'
    where rownum < 2 
      

  5.   

    rowid 可以实现了
    rownum 报错 请再给个rownum 的完整例子
      

  6.   

    ROWID 是可以的,ROWNUM不行
      

  7.   

    重复的取一条记录update ta a set a.name='b'
    where not exists(select 1 from ta b where a.id=b.id and a.rowid<b.rowid)
      

  8.   

    union一下也行.
    update ta a set a.name='b' 
    where not exists(select 1 from ta b where a.id=b.id and a.rowid <b.rowid)
      

  9.   

    SQL> select * from t1;        ID NAME
    ---------- --------------------
             1 xx
             1 xx
    --假设你想更新name为xx的数据
    SQL> update t1
      2  set name='gg'
      3  where name='xx'
      4  and rownum=1;1 row updated.SQL> select * from t1;        ID NAME
    ---------- --------------------
             1 gg
             1 xx
      

  10.   

    rownum不可以??
    使用子查询也不可以啊