通过查询得到结果集内容如下:
id   num
1    11
2    12 
3    22
4    32 
5    22
想要得到以下结果
id    num
1     1
2     1
3     1
.....换句话就是想把num字段下的所有内容用指定的1来代替.请高手指点...

解决方案 »

  1.   

    select id, 1 as num from tt
    update tt set num=1
      

  2.   

    替换后的内容,不要写回原表,只是用dbgrid显示出来!
      

  3.   


    select id, 1 as num from tt 
    就OK了
      

  4.   

    select id, 1 as num from tt 
    update tt set num=1
    妈的太简单了三分贴啊 
      

  5.   

    str :='select k.studentid as ''试卷号'',a.ksid as ''Part A'' ,b.ksid as ''Part B'',c.ksid as ''Part C'' '+ 
    ' from((((select studentid from record where gjid= '''+combobox3.Text +''' group by studentid) as k'+ 
    ' left join (select studentid,ksid from record where ksid like ''1%'' and gjid= '''+combobox3.Text +''' group by studentid ) as a on (k.studentid=a.studentid))'+ 
    ' left join(select studentid,ksid from record where ksid like ''2%'' and gjid= '''+combobox3.Text +''' group by studentid ) as b on (k.studentid=b.studentid))'+ 
    ' left join (select studentid,ksid from record where ksid like ''3%'' and gjid= '''+combobox3.Text +''' group by studentid) as c on (k.studentid=c.studentid))'; 这个是我的原码
    现在想把临时表a ,b ,c 中的内容全部用1代替
      

  6.   

    呵呵,直接将a ,b ,c 中的内容用1不行?
      

  7.   

    经WWWWA 指点,问题得到完满解决
    select k.studentid as ''试卷号'',if(isnull(a.ksid),null,1) as ''Part A''