|
-
Sep 15th, 2000, 11:09 AM
#1
Thread Starter
Junior Member
Hello, How do you get e.j. the last 10 rows added to any table?
Thanks!
Chicho
-
Sep 15th, 2000, 11:48 AM
#2
Chicho,
this depends on the database you are using and of your database design. let's assume you have an Access database.
1.
your table has one field of type autovalue. in this case just retrieve the first 10 records of a view sorted 'desc' by your autovalue field.
SELECT TOP 10 * FROM tblEmployees
ORDER BY Id DESC
2.
your table has no autovalue - field. in this case add a field of format date/time and set the 'default value' to 'Now()'. do the same as in the previous suggestion but this time use your date/time field.
SELECT TOP 10 * FROM tblEmployees
ORDER BY TimeStamp DESC
hope this helps
Sascha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|