How to show data of the most recent date? [duplicate]

3

I have a table1:

  • Auto_Increment ID;
  • varchar name;
  • data date;

I would like to see only the data with the most recent date. How do I?

    
asked by anonymous 05.09.2016 / 11:31

2 answers

5

Try to:

SELECT * FROM tabela1 WHERE data = (SELECT data FROM tabela1 ORDER BY data DESC LIMIT 1);
    
05.09.2016 / 11:38
2

You can do this all in a single select:

SELECT * FROM tabela1 ORDER BY data DESC LIMIT 1
    
05.09.2016 / 19:51