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

Select Last 10 records

Status
Not open for further replies.

Leon1977

IS-IT--Management
Jun 27, 2001
79
BG
I have an ID autonumber column in a TABLE, with lets say 100 rows from 1 to 200 (some of the rows ar mising)
so I want to display the last 10 records acording to the ID column
something like :
select * from TABLE
where ID > (select max(ID)-10 from TABLE)
but this doesn't do becouse it could return less then 10 records (if some of the rows between 200 and 190 are missing)
 
SELECT top 10 * FROM myTable ORDER BY id DESC -----------------------------------------------------------------
"The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'."
- unknown

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top