update a set flag=1 from 表 a join (select top 20 * from 表 where flag =0 order by idx ) b on a.idx=b.idx

解决方案 »

  1.   

    create proc aa
    asupdate a set flag=1 from 表 a join (select top 20 * from 表 where flag =0 order by id ) b on a.id=b.id
      

  2.   

    'asp中这样处理.set conn=server.CreateObject("adodb.connection")
    conn.Open strConn
    set rs=server.CreateObject("adodb.recordset")
    strSql="SELECT top 20 * FROM 表 WHERE flag=0   order by idx"  '改成top 20
    strsqltt="update 表 set flag=1 where idx in(select top 10 idx from 表 where flag=0 order by idx)"                                         '对应的修改更新条件
    conn.Execute strsql