读书人

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

发布时间: 2012-04-01 17:23:46 作者: rapoo

求一条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

读书人网 >SQL Server

热点推荐