I'm trying to sort a query in the database by grouping the information, however this is showing the first one registered in the database, but I want the last.
SELECT *
FROM base_rating AS B
JOIN historico_rating AS H ON B.id = H.id_base_rating
JOIN escala_rating AS E ON E.id = H.id_rating_atual
WHERE H.titulo!=''
AND E.agencia!=''
GROUP BY B.id_emissao