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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have the following table, where I 1

Status
Not open for further replies.

Raptor136

Technical User
Aug 26, 2002
39
US
I have the following table, where I am trying to select the last record of each ERO number. Obviously selecting Last in the Query by design isn't working. My Help system is dead and the install CD is cracked. Thanks in advance.

ID ERO DEF1 DEF2
11506 UP686 410- 30
11507 UP686 TEDD ALGN
11509 UP687 410- 30
11510 UP687 TEDD ALGN
11521 UQ908 ELTT NGAG
11522 UQ908 COMP ALGN

I want to keep the last instance of each ERO number. So in the example above, UP686 with ID 11507 would be kept, etc. I download from a mainframe daily, so I use the ID to keep the lines of the report in order.

Phil raptor136@adelphia.net
 
Select ID, max(ERO)
From Following_Table
Group by ID Regards
Warwick
 
Warwick,
You are the bomb. I was trying to use "last", and it didn't work. I tried using "max" showing all fields. Your way did it. I then created a select query which joined the "maxof" field with the original table so I could see the restricted set of tables. I'd buy you a beer if you were close. Much thanks.

Phil raptor136@adelphia.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top