Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newest version of a record 2

Status
Not open for further replies.

MzKitty

Programmer
Oct 28, 2003
254
US
Hi. I'm using Access 2002. I have a PSQL table that contains history tickets. A ticket can occur numerous times and each time it is revised, a new record is written with a sequence number that is incremented. For example:

ticket no unique
123456 104
123456 105
123456 106

I want to append to a table only the last record. How would I set up the criteria in the query?

Thanks
Cathy
 
This is how I would do it, provided that the "unique" field is an auto incremented number field:

Blah: Max(tablename.column_name)

The SQL statement:
Code:
INSERT INTO table (column)
SELECT Max(PSQL.unique) AS Blah
FROM PSQL;

Hope this helps.

Michael
 
A starting point (SQL code):
INSERT INTO [a table] ([ticket no], [unique])
SELECT [ticket no], Max([unique]) FROM PSQL GROUP BY [ticket no]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks to PHV and Michael. You both were alot of help. I got it working!
 
Pleasure, glad you got it working.

And thanks for the star!

Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top