views:

76

answers:

2

I need to retrieve the last record in a mysql database table - is there a command for this?

+3  A: 

Last by what order?

SELECT * FROM my_table ORDER BY something (DESC) LIMIT 1
ChssPly76
+1  A: 

Assuming you want the row with the largest auto-incrementing id, you can do this.

SELECT * FROM Table1 ORDER BY id DESC LIMIT 1
Mark Byers