E
Eskimo
I have a table with 21 columns, 4 of which I use in the following query
statement that gives me a sheet with all of the collars which have the best
signal, which is also the latest signal, on that particular day. But I need 3
other columns that provide the Latitude and Longitude and Activity Level for
each of the records showed up in the sql statement.
SELECT c1.Collar, c1.Obs_Date, Max(c1.Obs_Time) AS MaxTime, Max(c1.LC) AS
MaxOfLC
FROM Collars AS c1 INNER JOIN [SELECT Obs_Date, Collar, Max(LC) as MLC from
Collars group by Obs_Date, Collar]. AS c2 ON (c1.LC = c2.MLC) AND
(c1.Collar = c2.Collar) AND (c1.Obs_Date = c2.Obs_Date)
GROUP BY c1.Collar, c1.Obs_Date;
Out of the 21 columns, the four used in the SQL Statement above are Collar,
Obs_Date, Obs_Time and LC. Collar is Collar Number, Obs_Date is the date,
Obs_Time is the time and LC is an indicator of Position fix quality (possible
values are 1 to 7 with 7 being highest).
The above statement gives me the proper records I am looking for, but I am
having great difficulty with the adding of the columns LAT (Latitude), LON
(Longitude) and ACT (Activity level) into the sql statement.
The trouble comes when I add those columns, it gives me more records than
what I need. It ends up giving me all of the best LC's regardless of what
time it reported.
I need to be able to only to retrieve the best ranked LC for each collar for
each day, but since there can be more than one best ranked LC for each collar
on that day, I need to filter so that I can get the latest ranked record on
that day.
Hopefully you can help me out here.
Eskimo
statement that gives me a sheet with all of the collars which have the best
signal, which is also the latest signal, on that particular day. But I need 3
other columns that provide the Latitude and Longitude and Activity Level for
each of the records showed up in the sql statement.
SELECT c1.Collar, c1.Obs_Date, Max(c1.Obs_Time) AS MaxTime, Max(c1.LC) AS
MaxOfLC
FROM Collars AS c1 INNER JOIN [SELECT Obs_Date, Collar, Max(LC) as MLC from
Collars group by Obs_Date, Collar]. AS c2 ON (c1.LC = c2.MLC) AND
(c1.Collar = c2.Collar) AND (c1.Obs_Date = c2.Obs_Date)
GROUP BY c1.Collar, c1.Obs_Date;
Out of the 21 columns, the four used in the SQL Statement above are Collar,
Obs_Date, Obs_Time and LC. Collar is Collar Number, Obs_Date is the date,
Obs_Time is the time and LC is an indicator of Position fix quality (possible
values are 1 to 7 with 7 being highest).
The above statement gives me the proper records I am looking for, but I am
having great difficulty with the adding of the columns LAT (Latitude), LON
(Longitude) and ACT (Activity level) into the sql statement.
The trouble comes when I add those columns, it gives me more records than
what I need. It ends up giving me all of the best LC's regardless of what
time it reported.
I need to be able to only to retrieve the best ranked LC for each collar for
each day, but since there can be more than one best ranked LC for each collar
on that day, I need to filter so that I can get the latest ranked record on
that day.
Hopefully you can help me out here.
Eskimo