Reputation: 1387
I have many records in my table.I want to fetch 2 records which should have maximum or second last maximum id value .How will i do this in mysql?
Upvotes: 1
Views: 126
Reputation: 930
SELECT FROM [table] WHERE [condition] ORDER BY `id` DESC LIMIT 2
Upvotes: 5