dasphatman
Programmer
I'm having this golfclub where i want to create my own "world ranking" by getting the average of each players points, but I only want the script to consider the latest 10 records for each player. I have no problem with the first part as the script below does.
<%
Application("Connectionstring") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & _
Server.MapPath("db/my_db1.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT average, playerlist.Name FROM"
strSQL = strSQL & " (SELECT AVG(ranking.Point + ranking.Xtra_Point) AS average, playerlist.Name FROM"
strSQL = strSQL & " ranking INNER JOIN playerlist ON playerlist.PlayerID = ranking.PlayerID"
strSQL = strSQL & " GROUP BY playerlist.Name)"
strSQL = strSQL & " order by average desc"
rs.Open strSQL, Application("Connectionstring")
WHILE NOT rs.eof
%>
<td width="50%"><%=rs("Name")%></td>
<td width="50%"><div align="right"><%Response.Write FormatNumber(rs("average"),2)%> Point</div></td>
</tr>
<%
rs.Movenext
WEND
%>
Please help. It's driving me CRAZY....
<%
Application("Connectionstring") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & _
Server.MapPath("db/my_db1.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT average, playerlist.Name FROM"
strSQL = strSQL & " (SELECT AVG(ranking.Point + ranking.Xtra_Point) AS average, playerlist.Name FROM"
strSQL = strSQL & " ranking INNER JOIN playerlist ON playerlist.PlayerID = ranking.PlayerID"
strSQL = strSQL & " GROUP BY playerlist.Name)"
strSQL = strSQL & " order by average desc"
rs.Open strSQL, Application("Connectionstring")
WHILE NOT rs.eof
%>
<td width="50%"><%=rs("Name")%></td>
<td width="50%"><div align="right"><%Response.Write FormatNumber(rs("average"),2)%> Point</div></td>
</tr>
<%
rs.Movenext
WEND
%>
Please help. It's driving me CRAZY....