I need to return the Lease_Code with the newest date for each Tract_Code. There can be multiple Tracts with the same Lease_Code. I can get the newest date for each tract, but I am stuck trying to add the Lease_Code in those results.
View1 : PR_Mapping_Tract_TRS_Locat
Tract_Code (not unique)
Lease_Code (used to link to Code in Pr_Table_Lease)
View2 : PR_Table_Lease.Code
This code returns the newest date for each tract code:
Max(PR_Table_Lease.Expired_Date) AS Max_Expired_Date
INNER JOIN PR_Mapping_Tract_TRS_Location_Detail
ON PR_Table_Lease.Code = PR_Mapping_Tract_TRS_Location_Detail.Lease_Code
I am stuck adding Lease_Code in to the results.