query

T

Test

Hi!
I'm new to access and perhaps this is pretty basic.
I need a query to return the last row of the table. How
can this be achieved?
Thanks in advance!
 
D

Duane Hookom

Access tables don't have a "last" row. Records are like school children on a
playground. There is no order. Only after the bell rings and the students
get in line by classroom and alphabetical is one child last in line.
 
T

Test

Ok, understood; let's say that in that table there's an
autonumber column and what I need is to get the larger or
last value of that column; that would be the "last child
in line". Please help me!!
I guess there should be some clause like "Last", "Max" or
something like that to be included in the sql query.
Thanks in advance,
 
J

John Spencer (MVP)

You could do this with a subquery.

SELECT FieldA, FieldB, ...
FROM TableA
WHERE SomeField =
(SELECT Max(tmp.Somefield)
FROM TableA as Tmp)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top