I have the following table:
status_faturas
id_fatura | status | data
----------------------------------------
XX-XX-XX | 3 | 2017-01-04 21:00:24
XX-XX-XX | 2 | 2017-01-02 11:10:20
YY-YY-YY | 4 | 2017-01-04 21:00:24
YY-YY-YY | 1 | 2017-01-02 11:10:20
----------------------------------------
How can I set up a query to return (id_file, status, date) from the last status change?
The result of the query should be something like:
id_fatura | status | data
----------------------------------------
XX-XX-XX | 3 | 2017-01-04 21:00:24
YY-YY-YY | 4 | 2017-01-04 21:00:24
----------------------------------------
How to do this in a SQL query? Thank you in advance!