The title doesn’t actually fully describes the problem, that is: I have a table with dates –
1. 2011-07-01 13:01:48
2. 2011-07-01 13:09:36
3. 2011-07-01 13:21:24
4. 2011-07-01 13:35:12
5. 2011-07-01 13:49:23
6. 2011-07-01 13:57:47
7. 2011-07-01 14:05:12
8. 2011-07-01 14:12:45
9. 2011-07-01 14:31:48
10. 2011-07-01 14:47:31
and so on. What I need is to get three random dates of each hour, for example:
1. 2011-07-01 13:01:48
2. 2011-07-01 13:21:24
3. 2011-07-01 13:49:23
4. 2011-07-01 14:05:12
5. 2011-07-01 14:12:45
6. 2011-07-01 14:47:31
How can I do it in mysql?
This should work quite well if you have statistically enough rows per hour: