Take a look at the following sample dataset:
animal # Date detection at Stream mile 1 1/1/2013 100 1 1/2/2013 95 1 1/3/2013 95 1 1/4/2013 100 1 1/4/2013 95 1 2/6/2013 100 1 2/7/2013 110 1 3/12/2013 100 1 3/13/2013 100 2 1/1/2013 110 2 1/2/2013 90 2 1/10/2013 90 2 5/5/2013 100 2 5/7/2013 100 2 6/10/2013 100 2 6/11/2013 110
3 2/2/2013 100 3 2/3/2013 90 3 2/7/2013 100 3 2/14/2013 100 3 2/15/2013 90 3 2/20/2013 100
I would like to query out all animals that had at least one instance where they were detected at stream mile 100 followed by a detection at stream mile 100 that spanned 14 days or greater. For example, animal 1 was at stream mile 100 on 1/4/2013 and the next time at stream mile 100 was 2/6/2013. These dates are more than 2 weeks apart from each other so I would like all associated data for animal 1 to show up in my query. I would also expect the query to return no results for animal 3 because there are no gaps of 14 days or greater between successive detection's at stream mile 100.
The output I would like generated would be:
animal # Date Stream mile 1 1/1/2013 100 1 1/2/2013 95 1 1/3/2013 95 1 1/4/2013 100 1 1/4/2013 95 1 2/6/2013 100 1 2/7/2013 110 1 3/12/2013 100 1 3/13/2013 100 2 1/1/2013 110 2 1/2/2013 90 2 1/10/2013 90 2 5/5/2013 100 2 5/7/2013 100 2 6/10/2013 100 2 6/11/2013 110
I would be happy to explain in more detail if needed. Any help is appreciated.