J
jason
This query only returns the LAST record in the table. I want it to return
ALL records from the table )(which contain duplicate ListingsIDs) based on
the last ListingID added for that group of records.
Thus instead of just returning:
ListingID NewPrice ChangeDate
77 70,000 11/13/2004
From tblListingsPriceChanges:
ListingID NewPrice ChangeDate
28 70,000 05/10/2004
28 60,000 06/11/2004
32 50,000 02/13/2004
77 70,000 11/10/2004
77 60,000 11/11/2004
77 50,000 11/13/2004
* It should actually return: *
28 60,000 06/11/2004
32 50,000 02/13/2004
77 50,000 11/13/2004
Is this possible: Here is how my query currently looks (below). Could I just
add a * to the end of TOP? But, alas that does not work:
PARAMETERS LID Long;
SELECT TOP 1 tblListingsPriceChanges.ListingsID,
tblListingsPriceChanges.NewPrice, tblListingsPriceChanges.ChangeDate
FROM tblListingsPriceChanges
WHERE ((([LID]) Is Null)) OR (((tblListingsPriceChanges.ListingsID)=[LID]))
ORDER BY tblListingsPriceChanges.ChangeDate DESC;
ALL records from the table )(which contain duplicate ListingsIDs) based on
the last ListingID added for that group of records.
Thus instead of just returning:
ListingID NewPrice ChangeDate
77 70,000 11/13/2004
From tblListingsPriceChanges:
ListingID NewPrice ChangeDate
28 70,000 05/10/2004
28 60,000 06/11/2004
32 50,000 02/13/2004
77 70,000 11/10/2004
77 60,000 11/11/2004
77 50,000 11/13/2004
* It should actually return: *
28 60,000 06/11/2004
32 50,000 02/13/2004
77 50,000 11/13/2004
Is this possible: Here is how my query currently looks (below). Could I just
add a * to the end of TOP? But, alas that does not work:
PARAMETERS LID Long;
SELECT TOP 1 tblListingsPriceChanges.ListingsID,
tblListingsPriceChanges.NewPrice, tblListingsPriceChanges.ChangeDate
FROM tblListingsPriceChanges
WHERE ((([LID]) Is Null)) OR (((tblListingsPriceChanges.ListingsID)=[LID]))
ORDER BY tblListingsPriceChanges.ChangeDate DESC;