G
Guest
Help, I have been brain-storming on how to construct this query all day. I
finally thought I would ask some of you wonderful people. I have some survey
data where they are generating camera animal detections. The animal sets off
the camera when it goes near it and then it takes a picture of it. These
cameras are set at different stations, each station can have 1-4 human visits
to check the camera. The first visit being the set up of the camera, and the
sequential visit are to upload the data. Well each visit can have multiple
species detections etc. I am trying to construct a query that would tell me
what visit these species were detected in. I have the VisitStationId, Visit
Date and the Visit Number in one table, and in the other table I have
VisitStationId, PhotoEventDate, and species detected. So I know what Station
the animal was detected, and I have a date, but that's it. I need to know
whether UNSP1 were photographed during each visit 0=No Detection, 1 =
Detection for each visit and VisitStationId. To accomplish this I need to
relate and look at when the photographs were taken to the visit dates. For
Example. A photograph was taken on 11/MAR/2004 at Station 80401021. The
Set-up visit of "0" was on the 10/MAR/04. This new column with visit under
table two would get a 0, if it were after visit 1 date, but before visit 2
date, then it would receive a 1, if it were after visit 2 date, but before
visit 3 date, then it would receive a 2. etc. I would appreciate any
advice!!!!!
VisitStationId Visit# VisitDate
80401021 0 10/Mar/04
80401021 1 15/Mar/04
80401021 2 20/Mar/04
80401021 3 25/Mar/04
80401022 0 10/Mar/04
80401022 1 15/Mar/04
80401022 2 20/Mar/04
80401022 3 25/Mar/04
80401032 0 10/Mar/04
80401032 1 15/Mar/04
80401032 2 20/Mar/04
80401032 3 25/Mar/04
80401033 0 10/Mar/04
80401033 1 15/Mar/04
80401033 2 20/Mar/04
80401033 3 25/Mar/04
Table Two:
StationAnimalSpec PhotographDate
80401021 UNSP1 10/Mar/2004
80401021 UNSP1 11/Mar/2004
80401021 UNSP1 20/Mar/2004
80401021 UNSP1 20/Mar/2004
80401021 UNSP2 20/Mar/2004
80401021 UNSP2 20/Mar/2004
80401021 UNSP1 21/Mar/2004
80401021 UNSP2 21/Mar/2004
80401021 UNSP2 21/Mar/2004
80401022 UNSP1 10/Mar/2004
80401032 TADO 15/Mar/2004
80401032 TADO 15/Mar/2004
80401032 TADO 16/Mar/2004
80401032 TADO 16/Mar/2004
80401032 TADO 16/Mar/2004
80401032 TADO 16/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 21/Mar/2004
80401033 TADO 21/Mar/2004
finally thought I would ask some of you wonderful people. I have some survey
data where they are generating camera animal detections. The animal sets off
the camera when it goes near it and then it takes a picture of it. These
cameras are set at different stations, each station can have 1-4 human visits
to check the camera. The first visit being the set up of the camera, and the
sequential visit are to upload the data. Well each visit can have multiple
species detections etc. I am trying to construct a query that would tell me
what visit these species were detected in. I have the VisitStationId, Visit
Date and the Visit Number in one table, and in the other table I have
VisitStationId, PhotoEventDate, and species detected. So I know what Station
the animal was detected, and I have a date, but that's it. I need to know
whether UNSP1 were photographed during each visit 0=No Detection, 1 =
Detection for each visit and VisitStationId. To accomplish this I need to
relate and look at when the photographs were taken to the visit dates. For
Example. A photograph was taken on 11/MAR/2004 at Station 80401021. The
Set-up visit of "0" was on the 10/MAR/04. This new column with visit under
table two would get a 0, if it were after visit 1 date, but before visit 2
date, then it would receive a 1, if it were after visit 2 date, but before
visit 3 date, then it would receive a 2. etc. I would appreciate any
advice!!!!!
VisitStationId Visit# VisitDate
80401021 0 10/Mar/04
80401021 1 15/Mar/04
80401021 2 20/Mar/04
80401021 3 25/Mar/04
80401022 0 10/Mar/04
80401022 1 15/Mar/04
80401022 2 20/Mar/04
80401022 3 25/Mar/04
80401032 0 10/Mar/04
80401032 1 15/Mar/04
80401032 2 20/Mar/04
80401032 3 25/Mar/04
80401033 0 10/Mar/04
80401033 1 15/Mar/04
80401033 2 20/Mar/04
80401033 3 25/Mar/04
Table Two:
StationAnimalSpec PhotographDate
80401021 UNSP1 10/Mar/2004
80401021 UNSP1 11/Mar/2004
80401021 UNSP1 20/Mar/2004
80401021 UNSP1 20/Mar/2004
80401021 UNSP2 20/Mar/2004
80401021 UNSP2 20/Mar/2004
80401021 UNSP1 21/Mar/2004
80401021 UNSP2 21/Mar/2004
80401021 UNSP2 21/Mar/2004
80401022 UNSP1 10/Mar/2004
80401032 TADO 15/Mar/2004
80401032 TADO 15/Mar/2004
80401032 TADO 16/Mar/2004
80401032 TADO 16/Mar/2004
80401032 TADO 16/Mar/2004
80401032 TADO 16/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 20/Mar/2004
80401033 TADO 21/Mar/2004
80401033 TADO 21/Mar/2004