日期:2014-05-18 浏览次数:20626 次
select SUM(buyNumber) as zongshu,offer_id from dbo.crm_customer_offer_detail where offer_id in(select offer_id from dbo.crm_customer_offer) group by offer_id
update tb set value=t.zongshu from (select SUM(buyNumber) as zongshu,offer_id from dbo.crm_customer_offer_detail where offer_id in(select offer_id from dbo.crm_customer_offer) group by offer_id ) t where tb.offer_id=t.offer_id