Sample Header Ad - 728x90

Count total data with time interval in Postgresql

1 vote
1 answer
1861 views
I have an issue that I want to count total data with 1 hour interval. However start time is 7:30 Time Status 2022-03-24 07:36:00, Fail 2022-03-24 07:59:00, Pass 2022-03-24 09:32:00, Pass 2022-03-24 09:41:00, Pass 2022-03-24 10:02:00, Fail 2022-03-24 11:02:00, Pass 2022-03-24 11:22:00, Fail You can see that before 8:30 I have 2 data that 1 pass(07:59) and 1 fail(07:36) so I can count it and create data below Time Status Total 2022-03-24 08:30 Pass 1 2022-03-24 08:30 Fail 1 2022-03-24 09:30 Pass 0 2022-03-24 09:30 Fail 0 2022-03-24 10:30 Pass 2 2022-03-24 10:30 Fail 1 2022-03-24 11:30 Pass 1 2022-03-24 11:30 Fail 1
Asked by hem6d (15 rep)
Mar 24, 2022, 03:24 AM
Last activity: Mar 24, 2022, 03:31 AM