mySQL - How to select a date interval
Posted
by fabriciols
on Stack Overflow
See other posts from Stack Overflow
or by fabriciols
Published on 2010-03-22T14:17:00Z
Indexed on
2010/03/22
14:21 UTC
Read the original article
Hit count: 367
Hello,
this is my table :
-------------------------------------
| user | item | date_time |
| 10 | 01 | 10-10-10 20:10:05 |
| 10 | 02 | 10-10-10 20:10:10 |
| 10 | 03 | 10-10-10 20:10:10 |
| 20 | 02 | 10-10-10 20:15:10 |
| 20 | 02 | 10-10-10 20:20:10 |
| 30 | 10 | 10-10-10 20:01:10 |
| 30 | 20 | 10-10-10 20:01:20 |
| 30 | 30 | 10-10-10 20:05:20 |
-------------------------------------
i want to do a query that return a user that took multiple items in a 1min interval, like this result :
-------------------------------------
| user | item | date_time |
| 10 | 01 | 10-10-10 20:10:05 |
| 10 | 02 | 10-10-10 20:10:10 |
| 10 | 03 | 10-10-10 20:10:10 |
| 30 | 10 | 10-10-10 20:01:10 |
| 30 | 20 | 10-10-10 20:01:20 |
-------------------------------------
how i do this ?
© Stack Overflow or respective owner