UPDATE a SET a.PlanQuantity=b.StandardPlanQuantity
FROM #Result_Table a ,#temp_plan b
WHERE a.Productid=*b.Product_id and b.Product_id
is null

解决方案 »

  1.   

    insert into b(Product_id)
    select Product_id
    from #Result_Table a left join #temp_plan b on b.Product_id=a.Product_id
    where b.Product_id is null
      

  2.   

    insert into b(Product_id )
    select a.Product_id 
    from #Result_Table a left join #temp_plan b on a.Productid=*b.Product_id 
    where b.Product_id is null
      

  3.   

    insert #Result_Table (Product_id,PlanQuantity) select Product_id,StandardPlanQuantity from #temp_plan where Product_id not in (select Product_id from #Result_Table)
      

  4.   

    insert into b(Product_id )
    select a.Product_id 
    from #Result_Table a left join #temp_plan b on a.Productid=b.Product_id 
    where b.Product_id is null
      

  5.   

    insert #Result_Table(Product_id) select Product_id from #temp_plan where Product_id not in (select distinct Product_id from #Result_Table)