I want select days in months and count in four time ranges group by days

Multi tool use
The problem is with range 'THREE', to count from 10 pm till 06 am next day, result to be in previous day, i have this query who give me wrong data report,
any solutions please.
i want structure be like this example
Your problem is in the GROUP BY TRUNC (A.time)
- this says to start the window for each row/day at midnight, and end at 11:59 the following night. But you want it from 6am on the current day to 5:59 the next morning. So you want to GROUP BY TRUNC(A.time - 6/24)
- that way 5:59 this morning will be counted as yesterday, and 5:59 tomorrow will be counted as today.
Then you can modify your case THREE
to be:
Give it a try and let us know if you have any issues.
You might also want to change your cases from between
to > and <=
. between X and Y
includes both end values, so any events happening at precisely 2 PM would be double-counted as both ONE and TWO.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.