I am using this SQL code to pick up data, first it groups then it organizes by the birth date of rows .
SELECT U.id, U.born_data, U.bold
FROM users U GROUP BY U.bold ORDER BY U.born_data DESC
In the meantime it does an inversion, it organizes by date the rows selected by itself (always the first ones), but I want it to take the last rows of each grouping according to the date and after picking all make an organization again by the date, always from the most recent to the most distant date.
Look at an "example"
Table: users
id | bold | born_data
----------------------
1 | BR | 20/06/2015
2 | BR | 22/06/2015
3 | EN | 01/07/2015
It should return me two groupings, BR and EN however it will pick up according to the most recent date of each grouping and after all or that is it will show me this:
COUNT | bold | born_data
------------------------
(1) | EN | 01/07/2015 -> A DATA MAIS RECENTE DESSE AGRUPAMENTO é tambem a mais recente de todos os agrupamentos ou seja ela vem primeiro..
(2) | BR | 22/06/2015 -> A DATA MAIS RECENTE DESTE AGRUPAMENTO
Note that all data must be from the last row, as described in this problem that I encountered in Maicon's response.
"Oops, I'm going to relive here because I got a problem that I just noticed now the MAX function works perfectly showing the date of the recent, but it only shows the date of the most recent, I it shows all the latest information. Analyze this, sqlfiddle.com/#!9/22c35a/2 see that the ids is not the latest. "