Skip to content
Advertisement

Get HIGHEST and SECOND HIGHEST value for each ID (SQL)

New to SQL. In Access 2016. In a table of different equipment (EQUIP1, EQUIP2, EQUIP3), I want in a query the last and second to last maintenance dates.

Many fixes I have searched for do not account for grouping by an ID (EQUIP# in my case)

What I have:

What I need:

EDIT: Thanks! Got a little caught up on syntax, but here’s my final solution:

Desired Result

Advertisement

Answer

This is my solution, it might not be the cleanest but it should work in any SQL.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement