how to select last record from mysql table with last or another command

0

How to select last record of MySql table with last or other command

For example:

select last registro from tabela where coluna =23;

I've tried this code but it did not work.

    
asked by anonymous 17.09.2016 / 00:52

1 answer

1
If the table has an auto increment field, do the decrement and limit the result to 1 line.

SELECT registro FROM tabela WHERE coluna = 23 ORDER BY id DESC limit 1;
    
17.09.2016 / 01:01