Vandana

Vandana

  • 1.1k
  • 568
  • 72.8k

How to show zero value

Apr 3 2017 5:37 AM
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)