Ver Mensaje Individual
  #3 (permalink)  
Antiguo 13/05/2011, 10:50
Avatar de stramin
stramin
 
Fecha de Ingreso: marzo-2008
Ubicación: Cubil felino
Mensajes: 1.652
Antigüedad: 16 años, 2 meses
Puntos: 336
Respuesta: Sumar resultados en una Consulta

Puedes ahcerlo así:

Código MySQL:
Ver original
  1. SELECT ID,Nombre,SUM(Descuento) AS Total FROM mi_tabla GROUP BY Nombre

te daría este resultado:

ID Nombre Total
175 AMADOR VERA MARIA VICTORIA 657
176 GUZMÁN CABRERA FREDDY ARTURO 1346
178 ANGELES PEREZ TEOFILA 778

entregandote el total

<input type='text' name='ID' value='".$row['ID']."'>
<input type='text' name='nombre' size='40' maxlength='40' value='".$row['nombre']."'><input type='text' name='descuento' value='".$row['Total']."'>
__________________
El objetivo de este foro es orientar al usuario como un favor y no como una obligación.

Yo soy de los que dan puntos por aporte :D