Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/06/2014, 14:59
Avatar de gnzsoloyo
gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 4 meses
Puntos: 2658
Respuesta: MYSQL Ordenar consulta por diferentes ID

Técnicamente es posible, pero necesitarías conocer previamente el set de valores sobre los que se va a ordenar. De otro modo es imposible.
Algo como:
Código MySQL:
Ver original
  1. FROM noticias
  2. ORDER BY FIELD(id, 4,5,3,1,2);
Manual de referencia:
Cita:
FIELD(str,str1,str2,str3,...)

Returns the index (position) of str in the str1, str2, str3, ... list. Returns 0 if str is not found.

If all arguments to FIELD() are strings, all arguments are compared as strings. If all arguments are numbers, they are compared as numbers. Otherwise, the arguments are compared as double.

If str is NULL, the return value is 0 because NULL fails equality comparison with any value. FIELD() is the
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)