Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/06/2011, 15:09
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: Problemas con Querys

No olvidemos la función GROUP_CONCAT

Código MySQL:
Ver original
  1. mysql> SELECT usuario,GROUP_CONCAT(CONCAT('Categoria ',categoria) SEPARATOR ",") categoria FROM tabla GROUP BY usuario;
  2. +----------+-------------------------------------+
  3. | usuario  | categoria                           |
  4. +----------+-------------------------------------+
  5. | usuario1 | Categoria 7,Categoria 9             |
  6. | usuario2 | Categoria 9                         |
  7. | usuario3 | Categoria 7,Categoria 8,Categoria 9 |
  8. +----------+-------------------------------------+
  9. 3 rows in set (0.00 sec)
__________________
Without data, You are another person with an opinion.
W. Edwads Deming