Ciao a tutti,
con il codice sottostante controllo che in caso di 2 gare sullo stesso codicecampo non scarti il risultato (puntiCO) migliore. Il problema si presenta nel caso in cui sullo stesso codicecampo i puntiCO siano identici.
Per esempio se sullo stesso campo un giocatore ha acquistato prima 50 punti e poi 100 punti il codice non scarta i 100 punti ma i 50. ma se nel caso sullo stesso campo un giocatore conquista 100 punti in tutte e due le gare attualmente non lo scarta.
codice:
if contgare("contacampo") => 2 then
SQL = "SELECT punteggi.codiceGiocatore, Max(punteggi.PuntiCO) AS MaxDiPuntiCO, Gare.CodiceCampo "
SQL = SQL & "FROM ["&percorsoserver&"].Gare INNER JOIN punteggi ON Gare.CodiceGara = punteggi.CodiceGara "
SQL = SQL & "WHERE punteggi.codicegiocatore = '"&contGare("codicegiocatore") &"' "
SQL = SQL & "AND gare.codicecampo = "& contGare("codicecampo") &" "
'SQL = SQL & "AND punteggi.PuntiCO <> 0 "
SQL = SQL & "GROUP BY punteggi.codiceGiocatore, Gare.CodiceCampo "
SQL = SQL & "ORDER BY punteggi.codicegiocatore ASC "
Set tGare = Server.CreateObject("ADODB.Recordset")
tGare.open SQL,FigspConn,3,1
MaxDiPuntiCO = tGare("MaxDiPuntiCo")
MaxDiPuntiCO = replace(MaxDiPuntiCO,",",".")
sSql = ""
sSql = sSql & "update Punteggi INNER JOIN ["&percorsoserver&"].Gare ON punteggi.CodiceGara = Gare.CodiceGara "
sSQL = sSQL & "set ScartoPunti = 'N' "
sSql = sSql & "where CodiceGiocatore= '" & tGare("CodiceGiocatore") & "' "
sSql = sSql & "AND punteggi.puntiCO = "&MaxDiPuntiCO&" "
sSql = sSql & "AND gare.codicecampo = "&tGare("codicecampo")&" "
set rs=FigspConn.execute (sSql)
sSql = ""
sSql = sSql & "update Punteggi INNER JOIN ["&percorsoserver&"].Gare ON punteggi.CodiceGara = Gare.CodiceGara "
sSQL = sSQL & "set ScartoPunti = 'S' "
sSql = sSql & "where CodiceGiocatore= '" & tGare("CodiceGiocatore") & "' "
sSql = sSql & "AND puntiCO <> "&MaxDiPuntiCo&" "
sSql = sSql & "AND gare.codicecampo = "&tGare("codicecampo")&" "
set rs=FigspConn.execute (sSql)
end if
Grazie