select *,0 i into 你要得到的表 from 检索出来的表
declare @int,@a int
update 你要得到的表 
set @int =case when @a=yh_no then @int+1 else 1 end,
@a=a,i=int

解决方案 »

  1.   

    改正:
    select *,0 i into 你要得到的表 from 检索出来的表
    declare @int
    declare @a varchar(50)
    update 你要得到的表 
    set @int =case when @a=yh_no then @int+1 else 1 end,
    @a=a,i=int
      

  2.   

    哪不明白??运行这个就可以了~
    select *,0 i into 你要得到的表 from 检索出来的表
    declare @int
    declare @a varchar(50)
    update 你要得到的表 
    set @int =case when @a=yh_no then @int+1 else 1 end,
    @a=a,i=int
    若你要得到的表已存在则改为:
    insert into  你要得到的表 select *,0 from 检索出来的表
    declare @int
    declare @a varchar(50)
    update 你要得到的表 
    set @int =case when @a=yh_no then @int+1 else 1 end,
    @a=a,autid =int