怎么提出表中的数据,与另一个表进行关联

如何提出表中的数据,与另一个表进行关联
如何提出表中的数据,与另一个表进行关联
------解决方案--------------------
select *
from (select 列名 from a where xxx) a inner /left join b on 两表关联条件

其中a是只你的“表中的数据”,b是另外一个表
------解决方案--------------------
1.如果有关联字段 直接INNER JOIN 或者LEFT JOIN关联
2.如果没有 请告诉我提取和关联的规则。
------解决方案--------------------
update 目的表
set factorycode=a.factorycode,productcode=a.productcode ,storagecode=a.storagecode,batchcode =a.batchcode 
from (select factorycode,productcode, storagecode, batchcode ,                                          
sum(isnull(basedigit,0))basedigit  into a from  v_rukutest                                                                                                
where  dcode=@dcode) a
where a.主键=目的表.主键
------解决方案--------------------
update 目的表
set factorycode=a.factorycode,productcode=a.productcode ,storagecode=a.storagecode,batchcode =a.batchcode 
 from (select factorycode,productcode, storagecode, batchcode ,                                          
 sum(isnull(basedigit,0))basedigit  from  v_rukutest                                                                                                
 where  dcode=@dcode) a inner join 目的表 as b
on a.主键=.主键