Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Error: Operand data type datetime is invalid for sum operator.

$
0
0

I am trying to print 0 if the total of the count is 0 but not working 

select 
   sum(DATEADD(day, DATEDIFF(day, 0, dCreated), 0)) as TotalCount, 

   DATEADD(day, DATEDIFF(day, 0, dCreated), 0) as DateCreated

--sum(*) as total count
from ERROR_Tracking
where  szDescription like '%timeout%'  and dCreated > '2013-06-01' 

group by DATEADD(day, DATEDIFF(day, 0, dCreated), 0)
order by DATEADD(day, DATEDIFF(day, 0, dCreated), 0)

      

k


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>