I have a system that reports the XYZ location of items in a field to a SQL database. I am attempting to filter for false positives (only identifying moving items) by filtering for a known point in time when items pass a point, and at what location the items should be in after passing a point.
My logic is if an item is in one location and time AND in another location and time, it must have moved.
so I have this query:
SELECT tag_ID, X_location*3.28, Y_location*3.28, locate_time
FROM tag_blink_history
WHERE
(LOCATE_TIME > '2013-01-29 11:05:51'
AND LOCATE_TIME < '2013-01-29 11:06:56'
AND ((y_location*3.28 > 61)
AND (y_location*3.28 < 67.5))
AND ((x_location*3.28 > 14.5)
AND (x_location*3.28 < 17.5)))
AND (((y_location*3.28 > 70)
AND (y_location*3.28 < 75))
AND locate_time < '2013-01-29 11:06:50' )
ORDER BY tag_id DESC
Any ideas? I realize what I am asking SQL with the above query is for something in two places at once (which cannot happen), but what I want are records which exist in both these spatial constraints - I want records for when they were in both, not to ask for a record that is in both at the same time.