mysql query to get latest record by id code example Example: mysql get last row SELECT fields FROM table ORDER BY id DESC LIMIT 1;