
January 6th, 2004, 05:59 AM
|
|
Junior Member
|
|
Join Date: Jan 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Querly latest distinct values
Hi,
Sorry for this, I'm a newbie and I need help urgently:
I have three values from two tables to query: TABLE1.DATE, TABLE1.VALUE, TABLE2.STATUS
How do I query only the distinct values from TABLE1.VALUE and only the latest (based on the value of TABLE1.DATE)???
(TABLE2 and TABLE1 are related using a column called SITE_ID, where TABLE2.SITE_ID = TABLE1.SITE_ID)
Example:
TABLE1.DATE-----TABLE1.VALUE------TABLE2.STATUS
11/20/2003------------60--------------------1------
11/19/2003------------40--------------------0------
11/19/2003------------50--------------------1------
11/18/2003------------40--------------------0------
11/18/2003------------50--------------------1------
11/17/2003------------20--------------------0------
The query should return the following:
TABLE1.DATE-----TABLE1.VALUE------TABLE2.STATUS
11/20/2003------------60--------------------1------
11/19/2003------------50--------------------1------
11/19/2003------------40--------------------0------
11/17/2003------------20--------------------0------
Appreciate any help out there. Many, many thanks in advance!!!
|