How can I retrieve the last 10 rows inserted 开发者_开发问答into a table?
select * from tableName ORDER BY `created_at` DESC LIMIT 10
Hi you can use the below query, please ensure about the primary-key
field
select * from tbl ORDER BY 'ID' DESC LIMIT 10
There are two solutions for MySql
:
check the rowcount of your table and use limit
select count(*) from tableName; select * from tableName limit rowcount-10,rowcount;
PhpMyAdmin
displays the results using pagination. You can go to last pages to see last inserted records.
精彩评论