Get Last (Max) record in table

TimTDP

Registered User.
Local time
Today, 05:29
Joined
Oct 24, 2008
Messages
213
I have the table tblPO that contians the fields PO and SupplierId. Records in the field PO include: T1, T6, T9, T12

I need a query that will return the max PO, in this case T12

I have tried:
Code:
SELECT SupplierId, Max(PO) FROM tblPO;

But this returns T9

How do I get the query to return T12?
 
Get rid of the T and change the field to a numeric type.

Text fields are sorted alphanumerically and T9 always comes after T1 regardless of the characters that follow.
 
You get T9 because it is a txt field, and textSort.
You have to sort on number.
Look at "DemoMaxPoA20022003.mdb" (attachment, zip).
Look at Table, Query. Run Query2.
Adapt it in your mdb.
 

Attachments

Users who are viewing this thread

Back
Top Bottom