日期:2014-05-18 浏览次数:20450 次
---2. create table t1 ( id int, com int ) create table t2 ( id int, price int ) insert into t1 select 1,50 union all select 2,60 union all select 1,30 union all select 1,40 union all select 2,80 insert into t2 select 1,NULL union all select 2,NULL ---------------------------- update t2 set price=s from t2,(select id,sum(com) s from t1 group by id)tmp where t2.id=tmp.id
------解决方案--------------------