M
Mark
Small prob - any help guys?
I have a query like below.however say the one dog has the same best rating
more than once, my curent query brings up both those values.but i would like
it to only select one of the dogs best runs based on the best rating and the
most recent date.so this query works as it should but how do i get it to only
select the one with the most recent date??
SELECT Tfieldssel.Dog, TfieldsseldogTable.Rating AS BestRating,
TfieldsseldogTable.W_DATE AS bestdate1, TfieldsseldogTable.W_TRACK AS
besttrack1, TfieldsseldogTable.W_WGHT_CAR AS bestwt1,
tfieldsseldogTable.W_BOOK_PRI AS bestsp1, TfieldsseldogTable.TrackRating AS
besttr1
FROM Tfieldssel LEFT JOIN TfieldsseldogTable ON Tfieldssel.dog =
TfieldsseldogTable.dog
WHERE (((TfieldsseldogTable.Badj) In (select top 1 rating from
tfieldsseldogtable where tfieldssel.dog=tfieldsseldogtable.dog order by badj
desc) Or (TfieldsseldogTable.Badj) Is Null))
ORDER BY Tfieldssel.dog;
I have a query like below.however say the one dog has the same best rating
more than once, my curent query brings up both those values.but i would like
it to only select one of the dogs best runs based on the best rating and the
most recent date.so this query works as it should but how do i get it to only
select the one with the most recent date??
SELECT Tfieldssel.Dog, TfieldsseldogTable.Rating AS BestRating,
TfieldsseldogTable.W_DATE AS bestdate1, TfieldsseldogTable.W_TRACK AS
besttrack1, TfieldsseldogTable.W_WGHT_CAR AS bestwt1,
tfieldsseldogTable.W_BOOK_PRI AS bestsp1, TfieldsseldogTable.TrackRating AS
besttr1
FROM Tfieldssel LEFT JOIN TfieldsseldogTable ON Tfieldssel.dog =
TfieldsseldogTable.dog
WHERE (((TfieldsseldogTable.Badj) In (select top 1 rating from
tfieldsseldogtable where tfieldssel.dog=tfieldsseldogtable.dog order by badj
desc) Or (TfieldsseldogTable.Badj) Is Null))
ORDER BY Tfieldssel.dog;