当前位置: 代码迷 >> Sql Server >> 实例应用,该如何处理
  详细解决方案

实例应用,该如何处理

热度:87   发布时间:2016-04-27 18:00:22.0
实例应用



写语句将更新bounds的值
bounds=amount*price*5%
想了很久也想不出来。。也写不出来...

------解决方案--------------------
SQL code
update Saleset bounds=b.boundsfrom (select ID,sum(amount*price*0.05) as bounds from product group by ID)bwhere Sale.ID=a.ID
------解决方案--------------------
SQL code
update set bounds=b.boundsfrom  Sale a join(select ID,sum(amount*price*0.05) as bounds from product group by ID)bon   a.ID=a.ID
  相关解决方案