简单的update 问题,在线等........
ontime表
pecode totalprice
1 null
1 null
1 null
1 null
2 null
2 null
2 null
3 null
nowprice表
pecode minprice maxprice
1 0 44
2 0 11
3 null 0
现在ontime表的price价格是空的,我想根据pecode字段,去nowprice表找到相应的两个价格,把价格和相加,然后更新到ontime表totalprice字段中去,结果这样
pecode totalprice
1 44
1 44
1 44
1 44
2 11
2 11
2 11
3 0
[解决办法]
update ontime set totalprice=nowprice.totalprice from nowprice
where ontime.pecode=nowprice.pecode
[解决办法]
update ontime
set ontime.totalprice=nowprice.totalprice
form ontime,nowprice where ontime.pecode=nowprice.pecode
[解决办法]
update ontime set ontime.totalprice=isnull(nowprice.minprice,0)+isnull(nowprice.maxprice,0) from nowprice where ontime.pecode=nowprice.pecode