#estimated my idea of this query is to get the last records of each tract_id_tract. I want the output data to be displayed painted in an opaque blue color. I did a group by but it only shows me the first records of each tract_id_tract
SELECT id_seguro_obligatorio,DATEDIFF(vencimiento_seg_oblig,CURDATE()) AS contador,n_poliza,date_format(fecha_seg_oblig,'%d-%m-%Y') as fecha_seg_oblig , date_format(vencimiento_seg_oblig,'%d-%m-%Y') as vencimiento_seg_oblig,valor_seg_obligatorio,archivo_seg_oblig,tracto_id_tracto FROM seguro_obligatorio INNER JOIN tracto ON tracto.id_tracto=seguro_obligatorio.tracto_id_tracto
This is a minimal example of how to get the last of a group:
It remains for you to see how to implement it in your table