Home : General : Databases and SQL :

General: Databases and SQL: Re: [aragee] sql query to select last 5 entries: Edit Log

Here is the list of edits for this post
Re: [aragee] sql query to select last 5 entries
Hello aragee , If you have an auto_increment field in the table, you might try :

SELECT newsText FROM newsitems where id >= (LAST_INSERT_ID()-6)

where id is the name of an auto increment field, should return the last 5 rows from the table.


-- assuming the auto increment field has no deletions , so numbers are 1,2,3,4,5,6... not 1,2,10,11,12....


Thanks

cornball

Last edited by:

cornball: Oct 7, 2003, 10:47 PM

Edit Log: