Skip to content
Advertisement

How to make a query that brings the results of the day

I have this query but I want to bring the results processed on the day and if there is no data in excess on the day bring the last 100 processed.

SELECT * FROM tbl_classe where classe>= '2019-10-15';

Advertisement

Answer

You can use order by and limit (in both Postgres and MySQL):

SELECT *
FROM tbl_classe
ORDER BY classe DESC
LIMIT 100;

I’m not sure what 2019-10-15 has to do with the query. You seem to want the 100 most recent entries.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement