当前位置: 代码迷 >> Sql Server >> 想把两句sql合为一句,该怎么解决
  详细解决方案

想把两句sql合为一句,该怎么解决

热度:71   发布时间:2016-04-27 11:18:59.0
想把两句sql合为一句
请问怎么把下面的语句合为一句呢?谢谢

Declare @cje Money

Select @cje=Sum((isnull(jh_qty,0)-Isnull(xs_qty,0))*Sp_jhdj) From spjinhuo Where jh_qty>xs_qty and sp_tm='300002'

update SpKuCun set [email protected]/kcsl where kctm='300002'


------解决方案--------------------
SQL code
update SpKuCun set kcdj=(Select Sum((isnull(jh_qty,0)-Isnull(xs_qty,0))*Sp_jhdj)                          From spjinhuo                          Where jh_qty>xs_qty and sp_tm='300002')/kcsl where kctm='300002'
------解决方案--------------------
SQL code
update SpKuCun set kcdj=(Select Sum((isnull(jh_qty,0)-Isnull(xs_qty,0))*Sp_jhdj)                 From spjinhuo                    Where jh_qty>xs_qty and sp_tm='300002')/kcsl [email protected]where kctm='300002'
  相关解决方案