当前位置: 代码迷 >> Sql Server >> sql做连续减法怎么处理
  详细解决方案

sql做连续减法怎么处理

热度:56   发布时间:2016-04-25 01:21:48.0
sql做连续减法怎么办?
SQL code
(isnull((select sum(cq_dinner) from cjf_card_dzcq where cq_cardno=a.c_incode and cq_type='04' and cq_ctime<=:etime),0) -isnull((select sum(cq_dinner) from cjf_card_dzcq where cq_cardno=a.c_incode and cq_type='03' and cq_ctime<=:etime),0) ) as totaldinner//通过(isnull((select sum(cq_dinner) from cjf_card_dzcq where cq_cardno=a.c_incode and cq_type='04' and cq_ctime<=:etime),0) -isnull((select sum(cq_dinner) from cjf_card_dzcq where cq_cardno=a.c_incode and cq_type='05' and cq_ctime<=:etime),0) -isnull((select sum(cq_dinner) from cjf_card_dzcq where cq_cardno=a.c_incode and cq_type='03' and cq_ctime<=:etime),0) ) as totaldinner-//通不过


------解决方案--------------------
你的第二段Code, as totaldinner 后多了一个 减号, 去掉再试试。
  相关解决方案