Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/06/2006, 13:28
Avatar de vpino
vpino
 
Fecha de Ingreso: diciembre-2004
Ubicación: colombia
Mensajes: 265
Antigüedad: 19 años, 5 meses
Puntos: 0
como ordenar datos numericos

Hola señores. de nuevo necesitando de la ayuda vuestra. esta vez necesito ordenar el siguiente listado mediante una sentencia sql. busque en el for y econtre esto.

SELECT codigo, nombregrupo, descripcion
FROM partesdelequipo
ORDER BY CAST(codigo AS INT)

pero necesito que me ordene teniendo en cuenta el primer digito del codigo luego el segundo luego el tercero.... será que se puede.

agradezco cualquier ayuda.

codigo nombregrupo descripcion
1 GENERAL GENERAL
11 GENERAL UNIDAD DE CARGA
12 GENERAL UNIDAD TRACTORA
111 UNIDAD DE CARGA SUSPENSION
112 UNIDAD DE CARGA LLANTAS Y RINES
121 UNIDAD TRACTORA MOTOR
122 UNIDAD TRACTORA SISTEMA DE REFRIGERACION
1111 SUSPENSION SUSPENSION 1
1112 SUSPENSION SUSPENSION 2
1211 MOTOR SISTEMA DE INYECION
1212 MOTOR SISTEMA DE LUBRICACION
1213 MOTOR SISTEMA DE REFRIGERACION