Reputation: 9040
I need to retrieve the last record in a mysql database table - is there a command for this?
Upvotes: 1
Views: 170
Reputation: 837966
Assuming you want the row with the largest auto-incrementing id, you can do this.
SELECT * FROM Table1 ORDER BY id DESC LIMIT 1
Upvotes: 1
Reputation: 100696
Last by what order?
SELECT * FROM my_table ORDER BY something (DESC) LIMIT 1
Upvotes: 3