Ver Mensaje Individual
  #10 (permalink)  
Antiguo 12/10/2011, 07:41
sToRaGe
 
Fecha de Ingreso: mayo-2010
Mensajes: 51
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: sumar campos mysql y mostrar individualmente

Cita:
Iniciado por tinthenet Ver Mensaje
Código PHP:
$champ mysql_query("SELECT DISTINCT C.TEMPORADA, C.TIPO, J.NOMBRE, J.APELLIDO, SUM(C.GOLES) 
FROM CAMPEONATO C, JUGADORES J 
WHERE J.DORSAL=C.DORSAL AND TEMPORADA=(SELECT MAX(TEMPORADA) FROM CAMPEONATO) 
ORDER BY C.GOLES DESC [B]limit 10[/B];"
$link); 


while (
$row = @mysql_fetch_row($champ)){ 
echo 
"Jugador: ".$row[3].",".$row[2]." - Goles: ".$row[4]."<br>"

Gracias por el comentario tinthenet pero realmente no cambia nada este código, porque lo que hace es que muestra sólo 1 jugador con el total de goles del resto de jugadores:
Jugador: APELLIDO2,NOMBRE2 - Goles: 13
Incluso creo que coge el nombre del 1r jugador que encuentra, ni tan siquiera es el máximo goleador.

Espero que haya quedado algo más claro lo que quiero lograr.