Ver originalSELECT *,CAST(SUBSTRING_INDEX( `partida_presupuestal` , '-', 1 ) AS UNSIGNED),CAST(SUBSTRING_INDEX(SUBSTRING_INDEX( `partida_presupuestal` , '-', 2 ),'-',-1) AS UNSIGNED),CAST(SUBSTRING_INDEX(SUBSTRING_INDEX( `partida_presupuestal` , '-', 3 ),'-',-1) AS UNSIGNED)FROM comprobacioneselect WHERE id_proyecto='$id_proyecto' ORDER BYCAST(SUBSTRING_INDEX( `partida_presupuestal` , '-', 1 ) AS UNSIGNED),CAST(SUBSTRING_INDEX(SUBSTRING_INDEX( `partida_presupuestal` , '-', 2 ),'-',-1) AS UNSIGNED),CAST(SUBSTRING_INDEX(SUBSTRING_INDEX( `partida_presupuestal` , '-', -2 ),'-',1) AS UNSIGNED);