Query

  • Thread starter Thread starter arm
  • Start date Start date
A

arm

Hello! Could anyone please help me. I have this Table2 that has a
collection of all records which have been updated from Table1. Table1 &
Table2 have similar structure except that Table2 has this field called
"UPDATE DATE" which tells me the day & time when a particular record was
updated. So for a certain record in Tabled1 that was updated for several
times (eg. 3 times) that certain record will be created 3 times in Table2
with different "UPDATE DATE" value. Now here's my problem, is it possible to
display or extract just one record (with latest 'updated date') in a query?
How will the criteria be? Thank you very much for the help. c",)
 
Try something along the lines of

SELECT * FROM Table2 AS T1
WHERE [Update Date] In (SELECT Max([Update Date] FROM
Table2 AS T2 WHERE T2.primaryKeyCol = T1.primaryKeyCol)

where primarkKeyCol is the column that makes the row unique
in Table1.
If Table2 has multiple columns that make the Table1
primaryKey, then the WHERE clause in the subQuery would be
T2.primaryKeyCol1 = T1.primaryKeyCol1 AND T2.primaryKeyCol2
= T1.primaryKeyCol2 etc

Hope This Helps
Gerald Stanley MCSD
 
Back
Top