Get Last group of record

jjake

Registered User.
Local time
Today, 12:12
Joined
Oct 8, 2015
Messages
291
Hi,

I have 2 tables,

tblUpdateVersions

| UpdateID | StartDate| VersionNum |


TblUpdateStatus

| UpdateStatusID | VersionNum | UpdateDescription |


I'm trying to run a query to show the latest group of records that all have the latest VersionNum from tblUpdateStatus

When i use Last or Max it will not query the records. It just displays the same ones.


e.g

1, 1.0.1 , update 1
2, 1.0.2 , update 2
3, 1.0.2 , update 2.1
4, 1.0.3 , update 3
5, 1.0.3 , update 3.1
 
Hi. Are you really storing VersionNum instead of UpdateID in tblUpdateStatus?
 
If you include the PK ID in any grouping query you'll get all the records, as it is unique. Only include the fields you need to perform the group on.
 
it's a lookup field using both UpdateID and version num
Ah, bad news, but try this and let us know how it goes.
Code:
SELECT UpdateStatusID, VersionNum, UpdateDescription
FROM tblUpdateStatus
WHERE VersionNum = DMax("UpdateID","tblUpdateVersions")
 
Ah, bad news, but try this and let us know how it goes.
Code:
SELECT UpdateStatusID, VersionNum, UpdateDescription
FROM tblUpdateStatus
WHERE VersionNum = DMax("UpdateID","tblUpdateVersions")

Bam, Solved.
 
Hi. Glad to hear it worked for you. You probably already know why lookup fields are "bad news," so I won't lecture you on it. Good luck with your project.
 
I don't but i will definitely research it.
 

Users who are viewing this thread

Back
Top Bottom