UPDATE titles
SET t.ytd_sales = t.ytd_sales + s.qty
FROM titles t, sales s
WHERE t.title_id = s.title_id
AND s.ord_date = (SELECT MAX(sales.ord_date) FROM sales)
update m
set
价格=n.价格
from
B m,
(select t.* from A t where not exists(select 1 from A where 货品=t.货品 and 规格=t.规格 and 供应商=t.供应商 and 日期>a.日期)) n
where
m.货品=n.货品 and m.规格=n.规格 and m.供应商=n.供应商