String query = "select hour(la.dateLastUpdated) as hour," 
+ "coalesce(count(la), 0) from LoginActivity la" 
+ "where la.dateLastUpdated > :date" 
+ "group by hour(la.dateLastUpdated)" 
+ "order by hour(la.dateLastUpdated)";
Date date = new Date(System.currentTimeMillis() - 12*60*60*1000));
Result I'm getting is like
Hour  Count
----  -----
12    1
13    3
15    4
17    11
But I want result like
Hour  Count
----  -----
12    1
13    3
14    0
15    4
16    0
17    11
That means the zero counts. Tried coalesce but it's not working. Any probable hql query to get expected result? Native query also will do.
*I'm using PostgreSql database
                        
Try this one :::