Exclude latest record

  • Thread starter Thread starter KevinW
  • Start date Start date
K

KevinW

Hi,

Let's say I have a simple table with two fields. AutoID is a
AutoNumber, Details is text.

I have three records:

Record 1
AutoID: 1
City: Paris

Record 2
AutoID: 2
City: Madrid

Record 3
AutoID: 3
City: New York

If I want to create a query to select the last record I added, I can d
that: I simply select Top 1, and set AutoID to sort descending.

Here's what I can't do: create a query that returns everything *except
the last record I added. Is there some way I can exclude the las
record?

What I'm trying to say is 'not equals max[AutoID]' if that makes sense
I just can't find a way to say it!

Thanks,
Kevi
 
SELECT AutoId, City
FROM Table
WHERE AutoID <>
(SELECT MAX(Tmp.AutoID)
FROM Table as Tmp)
 
Back
Top