Skip to content
Advertisement

Counting number of records hour by hour between two dates in oracle

I need a SINGLE query that does this sequence in oracle.

As you see the hour is increasing one by one. here is the output






I have written a query but it does not give me the right answer!

this query gives me a result set that sum of it’s count(*) is equal to the first query written above! here is the result:

Advertisement

Answer

Note the usage of trunc expression with date values. You can omit the alter session if you are not running the query in sql*plus.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement