Ver Mensaje Individual
  #14 (permalink)  
Antiguo 27/07/2012, 11:24
sToRaGe
 
Fecha de Ingreso: mayo-2010
Mensajes: 51
Antigüedad: 14 años
Puntos: 0
Respuesta: Cómo hago para almacenar diferentes variables y ordenarlas?

Supongo que algo pondré mal en el phpmyadmin. Pongo lo siguiente (supongo que habrá además algún error con el uso de '' y ``):

SELECT `DORSAL`,`TIPO`,SUM(IF(TIPO='Liga',`GOLES`,0)) LIGA`,SUM(IF(TIPO='Amistoso',`GOLES`,0)) `AMISTOSO`,SUM(IF(TIPO='Copa',`GOLES`,0)) `COPA`,SUM(`GOLES`) `TOTAL`, MAX(`TEMPORADA`) `TEMPORADA`,
FROM `CAMPEONATO`,
GROUP BY `DORSAL`,
ORDER BY `TOTAL` DESC