create proc aa
as
insert into object_table 
select  用户的帖子数,精华帖数,积分 from source_table delete source_table
where 關鍵字not in(select 關鍵字 from object_table)

解决方案 »

  1.   

    create proc aa
    as
    insert into object_table 
    select  用户的帖子数,精华帖数,积分 from source_table delete source_table
    where 關鍵字 in(select 關鍵字 from object_table)
      

  2.   

    create proc aa
    as
    update object_table a set a.用户的帖子数 = a.用户的帖子数 + b.用户的帖子数,a.精华帖数 = 精华帖数 + b.精华帖数,a.积分 = 积分 + b.积分
    from source_table b where a.對應ID = b.對應IDdelete source_table
    where 對應ID not in(select 對應ID from object_table)