
February 10th, 2013, 05:41 PM
|
|
Contributing User
|
|
Join Date: Oct 2012
Posts: 35
Time spent in forums: 4 h 15 m 8 sec
Reputation Power: 1
|
|
|
Within: INTERVAL, BETWEEN, DATESUB Urgh!
I should know this, but I am having a hell of a time with a query. Am I crazy?
Got a few records with these timestamps:
2013-02-04 20:12:49
2013-02-03 21:15:25
2013-02-03 20:25:11
2013-02-03 17:08:13
2013-02-03 16:31:18
I am trying to count how many records came in 20 minutes prior to 2013-02-03 21:15:25 (which should be zero)
SELECT COUNT(*) from xferleads where timestamp > '2013-02-03 21:15:25' - INTERVAL 20 MINUTE AND customer = 1
The interval just won't give me the right count. Even at one minute I get 2 counts on the above dataset.
|