Display last 100 records

Ade F

Avid Listener
Local time
Today, 23:23
Joined
Jun 12, 2003
Messages
97
What criteria would I need to apply in order to show the last 100 entries in a record set?

Lets say I have a table

NoteID - Autonumber
Notes - Memo

How would I go about displaying the last 100 NoteID's

I'm sure there's a dmax or d something but I could not find it within the forums.

Regards

Ade
 
select NoteID, Notes from Table where
NoteID >= (Select Max(noteID) -100 from table)

Greetz
 
Sorry to be a dummy

Please could you look at the following graphic I think I have cocked up the query. I would like the last 100 job history ID's

query.gif


I'm sure my syntax is wrong.

Regards

Ade
 
Last edited:
Ade,

Code:
Select Top 100 NoteID, Notes
From   YourTable
Order By NoteID DESC

Wayne
 
Sorry but shoot me

I still cannot get the query to work, I have attached a stripped down table and query for you to look at.

Just the LAST ten ID's and notes displayed would be great.

Cheers

Ade
 

Attachments

Last edited:
Ade,

Code:
SELECT TOP 10 [job history].ID, [job history].Notes, [job history].Date, [job history].Time
FROM [job history]
ORDER BY [job history].ID DESC;

ps,
Don't use Date & Time as names, they're reserved and will cause you
problems sooner or later.

hth,
Wayne
 
Great stuff

It works like a charm Wayne

Sorry for the Names I did it very quickly to ask to question although yes it is a no no ;) .

I feel a prat because all I had to do was add TOP 10.

Many thanks for your ultra fast response.

Regards

Ade
 
Last edited:

Users who are viewing this thread

Back
Top Bottom