The doubt is simple, but unfortunately I do not think the resolution. I have a table with several records, and I need to make a query that returns the last record of each day of the last 20 days for example.
Exemplo:
|------------ teste ---------------|
|id | valor1 | data |
| 1| 12 | 2016-01-01 00:41:00|
| 2| 31 | 2016-01-01 23:00:12|
| 3| 34 | 2016-01-02 00:41:00|
| 4| 63 | 2016-01-03 05:20:21|
| 5| 87 | 2016-01-03 13:51:00|
| 6| 95 | 2016-01-03 14:00:00|
The search should return the record [2, 3, 6].