I'm doing a query in the database, follow my table below
id | protocolo | status | alteracao | datahora
1 2 1 teste 2014-11-10 15:23:44
2 2 3 teste 2014-11-10 14:23:44
3 2 4 teste 2014-11-10 13:23:44
4 1 2 teste 2014-11-10 09:23:44
5 1 3 teste 2014-11-10 10:23:44
I need to bring the result by grouping the protocols by the last value of datahora
,
or so I need the result like this:
id | protocolo | status | alteracao | datahora
1 2 1 teste 2014-11-10 15:23:44
5 1 3 teste 2014-11-10 10:23:44