Query last entry in a field

G

Guest

I'm trying to run a query with the 5 fields, and I want the query to use only
the last entry of the 5th field. I know how to bring up "Totals" and use last
for that field, but the problem is I'm getting duplicates, and it's showing
previous entries for that fifth field.

Any help would be greatly appreciated.
 
M

[MVP] S.Clark

Post your SQL and we can give you exacts, but I don't think you've defined
the Groupings well enough in the query.

For example:
Select f1, f2, Last(f3) from tablename GROUP BY f1, f2

This one groups by fields f1 & f2, then returns the Last of f3 based on
those two.

Make sure you read the help file about how Last really work. I seem to
recall that it doesn't really do what you think it is supposed to, but I
don't remember why I thought that.


--
Steve Clark, Access MVP
FMS, Inc
http://www.fmsinc.com/consulting
Professional Access Database Repair
*FREE* Access Tips: http://www.fmsinc.com/free/tips.html
 
G

Guest

You know what, I was driving home I came up with the answer. I need to use
last for some of the fields as well, because there are multiple entries on
some, otherwise it will show that fifth field's previous entries as well.

I don't even think that makes sense but I'm pretty sure that's the answer.
 
D

Duane Hookom

I'm pretty sure your results will be inconsistent since records are
generally unordered in your table so there is no "Last". You need to look at
field values to determine which record from a group of records to return.
 
A

Allen Browne

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