Mysql
 SQL >> Database >  >> RDS >> Mysql

Come selezionare l'intera riga con l'ID più grande della tabella?

Potresti usare una sottoquery:

SELECT row FROM table WHERE id=( SELECT max(id) FROM table ) 

Nota che se il valore di max(id) non è univoco, vengono restituite più righe.

Se vuoi una sola riga, usa la risposta di @MichaelMior:

SELECT row from table ORDER BY id DESC LIMIT 1