I'm displaying the number of transactions every hour, which works great. However, now I have a requirement to display that hr on which 0 transactions are occurred along with the hrs transaction exist. so display the hr number and display 0 if there no transaction count in that hr.
Not sure if I was able to explain correctly for which I'm really sorry(if I dont) but the below SQL statement and output would help you understand what I'm trying to achieve.
SQL Query I'm running on SQL Server is
   SELECT CAST([transOcurredOn] AS DATE) as Dategg, 
   DATEPART(HH,transOcurredOn) as 'hour',
   COUNT(*) AS 'Trans count'
   FROM [tpTrans]
   WHERE [transOcurredOn] > '2016-06-18' 
   GROUP BY CAST([transOcurredOn] AS DATE) ,DATEPART(HH,transOcurredOn)
   ORDER BY Dategg,hour
So my Current output looks like
my new output should look like below, to cover the whole 7 to 23 hrs clock. I highlighted the change
I am bit struggling, appreciate if someone points me in the right direction
Blockquote
ing, app


 
     
     
    