Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/10/2009, 08:54
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 3 meses
Puntos: 360
Respuesta: Número X de un total de Y

Código mysql:
Ver original
  1. mysql> desc order_m;
  2. +-------+-------+------+-----+---------+-------+
  3. | Field | Type  | Null | Key | Default | Extra |
  4. +-------+-------+------+-----+---------+-------+
  5. | nom   | text  | YES  |     | NULL    |       |
  6. | valor | float | YES  |     | NULL    |       |
  7. +-------+-------+------+-----+---------+-------+
  8. 2 rows in set (0.02 sec)
  9.  
  10. mysql> SELECT
  11.     ->     (@REG := @REG + 1) Linea,
  12.     ->     nom,
  13.     ->     valor
  14.     -> FROM
  15.     ->     (SELECT
  16.     ->         @REG :=0,
  17.     ->         nom,
  18.     ->         valor
  19.     ->     FROM order_m) om order by om.valor desc;
  20. +-------+-------+-------+
  21. | Linea | nom   | valor |
  22. +-------+-------+-------+
  23. |     1 | maria |    43 |
  24. |     2 | ana   |    24 |
  25. |     3 | juan  |    20 |
  26. |     4 | pepe  |    14 |
  27. |     5 | santi |     3 |
  28. +-------+-------+-------+
  29. 5 rows in set (0.02 sec)
  30.  
  31. mysql>

algo así?
__________________
Without data, You are another person with an opinion.
W. Edwads Deming