问题是: 一个表里面,有一万条数据。在表里面有一个属性,列如(temp) 属性。
temp的数据为 1, 2, 3, 4, 这样平均循环。
现在要更新成(temp的数据为 1, 2, 3, 4, 这样平均循环。)数据。。求大侠, 好好想想,,,求求

解决方案 »

  1.   

     列如:  student表  studentnum属性,原先是 1,2,3,4,5,6..............。现在改成  1,2,3,4,;1,2,3,4,;这种student表有一万条这样的数据懂了吧。
      

  2.   


    --用下面这条语句试试看是不是你想要的
    update student s set s.studentnum=mod(s.studentnum+3,4)+1;;
      

  3.   

    四点多,给我回帖,,我确实震惊了。太谢谢了。。
    我说一下我的吧。。update tables  set  ='1(是字符串的)'  where  条件。(i)
    i := i + 1 ;
    update tables  set ='2'  where  条件(i)
    i := i + 1 ;
    update tables  set ='3'   where 条件(i)
    i := i + 1 ;
    因为循环里面有这样的四条更新语句。 所以 条件无法确定用的是 while 
      

  4.   

    z这里面  这几个是死的,修改的是条件
    update  tables  set = '1' where (活儿)update tables set ='2' where (活得)update tables set ='3 ' where ....update tables set ="4" where ...
      

  5.   

    楼主啊你描述问题描述的真太那个了,看不懂,你一开始说1,2,3,4,5,6..............。现在改成 1,2,3,4,;1,2,3,4,;现在又变成这样,而且还描述的不清楚,我按我的理解给你写了条语句,你看看是不是你想要的update 表名
       set 字段名 = case when 条件1 then '1' when 条件2 then '2' when 条件3 then '3' when 条件4 then '4' end;