UPDATE c
SET fid = b.Id
FROM c tc
INNER JOIN b tb ON tc.Id = tb.pid
INNER JOIN a ta ON ta.Name = tb.Name
这是一个关联表的批量更新
可以参考:
http://www.cnblogs.com/downmoon/archive/2007/12/29/1019832.html
写入c表的fid字段,还是更新?
a表的name字段和b表的name字段比较
是不是
INSERT C(FID)
SELECT B.ID FROM A JOIN B ON A.NAME=B.NAME