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

Posted on

Question :

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?

    

Answer :

Try to:

SELECT * FROM tabela1 WHERE data = (SELECT data FROM tabela1 ORDER BY data DESC LIMIT 1);

    

You can do this all in a single select:

SELECT * FROM tabela1 ORDER BY data DESC LIMIT 1

    

Leave a Reply

Your email address will not be published. Required fields are marked *