【发布时间】:2013-05-30 12:23:46
【问题描述】:
我有一个这样的查询:
SELECT TV.Descrizione as TipoVers,
sum(ImportoVersamento) as ImpTot,
count(*) as N,
month(DataAllibramento) as Mese
FROM PROC_Versamento V
left outer join dbo.PROC_TipoVersamento TV
on V.IDTipoVersamento = TV.IDTipoVersamento
inner join dbo.PROC_PraticaRiscossione PR
on V.IDPraticaRiscossioneAssociata = PR.IDPratica
inner join dbo.DA_Avviso A
on PR.IDDatiAvviso = A.IDAvviso
where DataAllibramento between '2012-09-08' and '2012-09-17' and A.IDFornitura = 4
group by V.IDTipoVersamento,month(DataAllibramento),TV.Descrizione
order by V.IDTipoVersamento,month(DataAllibramento)
这个查询必须总是返回一些东西。如果没有结果产生一个
0 0 0 0
必须返回行。我怎样才能做到这一点。对每个选定的字段使用 isnull 没有用。
【问题讨论】:
-
Kinfly 提供完整的查询。
-
@Luv 全部代码现报...