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
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
insert #Result_Table (Product_id,PlanQuantity) select Product_id,StandardPlanQuantity from #temp_plan where Product_id not in (select Product_id from #Result_Table)
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
insert #Result_Table(Product_id) select Product_id from #temp_plan where Product_id not in (select distinct Product_id from #Result_Table)
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
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
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