tags:

views:

65

answers:

3

How can I retrieve the last 10 rows inserted into a table?

+4  A: 
select * from tableName ORDER BY `created_at` DESC LIMIT 10
Salil
how can i retrieve through user id
Hari kanna
I guess you want something like select * from tableName where user_id=10 ORDER BY `created_at` DESC LIMIT 10
Salil
+1  A: 

MySQL :: MySQL 3.23, 4.0, 4.1 Reference Manual :: 11.13 ...

http://dev.mysql.com/doc/refman/4.1/en/information-functions.html

ratty
+1  A: 

Hi you can use the below query, please ensure about the primary-key field

select * from tbl ORDER BY 'ID' DESC LIMIT 10
VAC-Prabhu