Last aggregate function

  • Thread starter Thread starter Gus Chuch
  • Start date Start date
G

Gus Chuch

The SQL Last function is to return the last value entered in a record, right?
The follow code will sometimes return the last entered value and sometime
not, why?
SELECT Last(tblEquipment.EquipmentID) AS LastOfEquipmentID
FROM tblEquipment;
 
Last doesn't return "the last value entered in a record", it returns "the
last value in a recordset". Since you cannot be sure of the order in which
records are returned if you don't have an ORDER BY clause in your SQL, you
can never be sure what Last will return for your query.
 
Back
Top