当前位置: 代码迷 >> Sql Server >> 求一条SQL语句,很简单,该如何处理
  详细解决方案

求一条SQL语句,很简单,该如何处理

热度:85   发布时间:2016-04-27 13:45:55.0
求一条SQL语句,很简单
select (select sum(Quantity) from OrderProcList c where c.productguid=a.guid) Quantity from menutable a where userguid='2' 

我本来是要求Quantity和但是如果两边GUID不对就显示NULL,但我想没有的时候显示0应该怎么写啊

------解决方案--------------------
select isnull((select sum(Quantity) from OrderProcList c where c.productguid=a.guid),0) Quantity
  相关解决方案