以此类推?怎么推?
对于回帖数大于10的主题帖, 则将图标修改(即1.gif改为2.gif, 而2.gif改为1.gif)?

解决方案 »

  1.   

    以此类推?
    就是
    把id=1的ico改为2.gif
    把id=2的ico改为2.gif
    把id=10的ico改为1.gif
    把id=11的ico改为2.gif
    。。
      

  2.   

    其实就是根据
    1 2.gif
    2 2.gif
    10 1.gif
    11 2.gif
    22 2.gif
    45 2.gif
    46 2.gif
    75 2.gif
    141 2.gif
    142 2.gif这张表来update另一张表,如tableAAA
    tableAAA有字段如下:
    id    replyNum
    1     0.gif
    2      1.gif
    10     2.gif
    现在要更新
    使其变为:
    id    replyNum
    1     2.gif
    2      2.gif
    10     1.gif
      

  3.   

    --建测试环境
    create table 表A (id int,col varchar(20))
    insert into 表A select 1,'2.gif'
    union all select 2,'2.gif'
    union all select 10,'1.gif'
    union all select 11,'2.gif'
    union all select 22,'2.gif'
    union all select 45,'2.gif'
    union all select 46,'2.gif'
    union all select 141,'2.gif'
    union all select 142,'2.gif'create table 表B (id int,replyNum varchar(20))
    insert into 表B select 1,'0.gif'
    union all select 2,'1.gif'
    union all select 10,'2.gif'--更新
    update 表B  
    set replyNum= a.col
    from 表A a,表B b
    where b.id=a.id--查看结果 select * from 表B
    id          replyNum             
    ----------- -------------------- 
    1           2.gif
    2           2.gif
    10          1.gif(所影响的行数为 3 行)