I'm saving (PHP) user accesses to a mySQL dB as follows
| IP Number | date | time |
-------------------------------------------
| 193.12.143.145 | 2017-03-05 | 15:02 |
| 121.144.98.201 | 2017-03-05 | 15:38 |
| 188.34.12.167 | 2017-05-18 | 09:13 |
| 191.13.122.201 | 2017-05-18 | 09:51 |
| 167.98.101.157 | 2017-06-22 | 11:44 |
-------------------------------------------
I would like to group
and count
IPs by date and time with intervals of one hour so that the expected output would be:
| date | time | count |
---------------------------------
| 2017-03-05 | 15:00 | 2 |
| 2017-05-18 | 09:00 | 2 |
| 2017-06-22 | 11:00 | 1 |
---------------------------------
I tried the answers found on Stackoverflow but none produce the desired result. Notice infact that second table prints the hours as 15:00, 9:00, 11:00.