sql query to retrive last records or new records
Database
2
Posts
2
Posters
0
Views
1
Watching
-
how to retrieve the last 4 or 5 records from a database table, i want to retrive the latest recirds which are entered not all or old records
If you have some way of determining the time (or sequence) the rows were inserted in the table (e.g. a date stamp column, of an incremental sequence number or id) then this is quite easy.
SELECT TOP 5 * FROM MyTable ORDER BY TimeStamp DESC
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website