Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/10/2009, 12:29
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 16 años, 1 mes
Puntos: 360
Respuesta: Ayuda: SELECT con ORDER BY

Código mysql:
Ver original
  1. mysql> select *from numeros;
  2. +------+
  3. | id   |
  4. +------+
  5. | 7    |
  6. | 4    |
  7. | 9    |
  8. | 3    |
  9. +------+
  10. 4 rows in set (0.00 sec)
  11.  
  12. mysql> select *from numeros where id in('7','3','9','4');
  13. +------+
  14. | id   |
  15. +------+
  16. | 7    |
  17. | 4    |
  18. | 9    |
  19. | 3    |
  20. +------+
  21. 4 rows in set (0.00 sec)
  22.  
  23. mysql> select *from numeros where id in('7','3','9','4') order by field(id,'7','3','9','4');
  24. +------+
  25. | id   |
  26. +------+
  27. | 7    |
  28. | 3    |
  29. | 9    |
  30. | 4    |
  31. +------+
  32. 4 rows in set (0.00 sec)

La ultima consulta es la que funciona.

saludos
__________________
Without data, You are another person with an opinion.
W. Edwads Deming