SELECT * FROM ( SELECT * FROM table ORDER BY id DESC LIMIT 50 ) sub ORDER BY id ASC
mysql> select *from DemoTable -> where Id=(select max(Id) from DemoTable);