Query that counts number of rows per hour
Application Type
Traditional Web

Hi, does someone can help me?

I need to get the number of rows that exist in an hour for a certain period.

Example result:

Period between 12:00h and 15:00h

12:00h - 50
13:00h - 47
14:00h - 33

Can someone give me a clue on how to do it?

mvp_badge
MVP
Solution

Hi João,


You can make a query where you:

  1. add a field (called for instance Hour) which is Hour(<Date Time / Time field>);

      2. group by that field (in the example, the field Hour);

      3. Make a count on the id or other field of the entity with the rows you want to count.


The output of this query will be the different hours and the total number of rows.

If you want to have the results returned with the hours ordered, just add a sort on the field you created (in my example Hour).

Kind Regards,
João

Thanks a lot!!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.