Probs Selecting Top Value Fields (1 Viewer)

mikebaldam

Registered User.
Local time
Today, 10:34
Joined
Oct 29, 2002
Messages
114
I'm trying to get a query to work on a table pulling down all information in the table only by the latest dates for each AddressID (which is a foregin key from TblAddress).

I'm having trouble using the TOPVALUE option as this will only display the information for the TOPVALUE of AddressID and not for each AdderssID's Date field.

Is there another way of getting this information

I think I may be going about this all wrong..... so any advice would be greatfully apppreciated...

Thanks

Mike
 

Nouba

Registered User.
Local time
Today, 11:34
Joined
Oct 20, 2002
Messages
145
This query shows one way to accomplish the goal.
Code:
SELECT
  T.ADDRESSID
, T.DATEFIELD
FROM YourTable AS T
WHERE T.DATEFIELD = (
  SELECT
    Max(DATEFIELD)
  FROM YourTable
  WHERE ADDRESSID = T.ADDRESSID)
 

mikebaldam

Registered User.
Local time
Today, 10:34
Joined
Oct 29, 2002
Messages
114
Works a treat



Cheers


Mike
 

Users who are viewing this thread

Top Bottom