Ciao a tutti,
volevo sapere come fare per creare la somma dei valori presenti un una tabella di un db... cerco di spiegarmi meglio...:
allora... effettuo una query sul db e mi stampa a video questi valori:
Utente: 1 Punti: 12
Utente: 1 Punti: 10
Utente: 2 Punti: 9
Utente: 3 Punti: 21
Utente: 2 Punti: 5
Utente: 1 Punti: 10
come faccio ad avere un risultato del genere? :
Utente: 1 Punti: 32
Utente: 2 Punti: 14
Utente: 3 Punti: 21
in poche parole dovrebbe raggruppare e sommare i dati per il tipo di utente...
....
in codice che uso è il seguente...:
vi ringrazio per la collaborazione...codice:<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Dim Recordset1 Dim Recordset1_numRows Set Recordset1 = Server.CreateObject("ADODB.Recordset") Recordset1.ActiveConnection = MM_connessione_calcolo_STRING Recordset1.Source = "SELECT * FROM calcolo" Recordset1.CursorType = 0 Recordset1.CursorLocation = 2 Recordset1.LockType = 1 Recordset1.Open() Recordset1_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = 10 Repeat1__index = 0 Recordset1_numRows = Recordset1_numRows + Repeat1__numRows %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Documento senza titolo</title> </head> <body> <% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %> Utente: <%=(Recordset1.Fields.Item("id_giocatore").Value)%> Punti: <%= Abs((Recordset1.Fields.Item("punti").Value)) %> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 Recordset1.MoveNext() Wend %> </body> </html> <% Recordset1.Close() Set Recordset1 = Nothing %>
ciao

Rispondi quotando
guarda la query e i campi che tiri fuori e capirai l'errore.
scusa
