# Oracle Query - Hourly Count

**URL:** <https://forum.inductiveautomation.com/t/oracle-query-hourly-count/9978>\
**Category:** Ignition\
**Created:** [May 5, 2015, 1:14pm UTC](https://forum.inductiveautomation.com/t/oracle-query-hourly-count/9978 "2015-05-05T13:14:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kykam](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@kykam](https://forum.inductiveautomation.com/u/kykam)\
**Post date:** [May 5, 2015, 1:14pm UTC](https://forum.inductiveautomation.com/t/oracle-query-hourly-count/9978/1 "2015-05-05T13:14:06Z")

</div>

I’m in need of some help on how to write a query. I pretty familiar with MSSQL but I am just starting on Oracle now. I know I need to use the Dual table in some way, I just can’t seem to get the syntax right.

Here is what I have so far, which returns the row count of each hour on a specific day (’{Root Container.Label 2.text}’ is a date)

`SELECT trunc("TimeEntered",'HH') as t_stamp, count(*) as rate
FROM myTable
Where trunc("TimeEntered",'DD') = '{Root Container.Label 2.text}'
GROUP BY trunc("TimeEntered", 'HH') 
ORDER BY t_stamp asc
`

However, the query about does not return a value of 0 if there is no data for that specific hour.

How do I join the above query with a table of 24 hours to get the hours with 0?

Thanks
