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
from Test.dbo.LeadTable
where
DATEPART(mm,ApptDate)='1'
and DATEPART(yy,ApptDate)='2017'
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


Nitin SontakkeRank #264 · 9.6K reputationPosted Apr 3, 2017, 1:56 AM EDT
Ramesh PalanivelRank #372 · 6.8K reputationPosted Apr 3, 2017, 1:44 AM EDT
Guest UserRank #816 · 2.8K reputationPosted Apr 3, 2017, 1:44 AM EDT
Satyaprakash SamantarayRank #101 · 21.1K reputationPosted Apr 25, 2017, 10:50 PM EDT