4
Answers

How to show zero value

Ask a question
Hey,
 
I have an issue that I have to show zero amount if there is no record in the table column.
 
select DATEPART(mm,ApptDate)as Month, SUM(coalesce(AgentAmount,0)) as [Tolling]
from Test.dbo.LeadTable
where 
DATEPART(mm,ApptDate)='1'
and DATEPART(yy,ApptDate)='2017'

GROUP BY DATEPART(mm,ApptDate) 
 
 
 
There is no data in jan 2017 but i want to show 0 value.
 
 
Please help me
 

Answers (4)