Hej!
Jag håller på att göra en tabell där man visar hemmastatistik. Koden nedan skriver ut all statistik på hemmaplan för laget med id 1 (lagid = 1).
Här kommer en dålig SQL sats som jag använder:
[red]strSQL = "SELECT COUNT(*) FROM tblSpel WHERE ligaid = " & intID
Set objRSH = Conn.Execute(strSQL)
strSQL = "SELECT COUNT(*) FROM tblSpel WHERE ligaid = " & intID & " AND hlag = 1 AND hmal IS NOT null"
Set objRSHM = Conn.Execute(strSQL)
strSQL = "SELECT COUNT(*) FROM tblSpel WHERE ligaid = " & intID & " AND hlag = 1 AND hmal > bmal"
Set objRSHV = Conn.Execute(strSQL)
strSQL = "SELECT COUNT(*) FROM tblSpel WHERE ligaid = " & intID & " AND hlag = 1 AND hmal = bmal"
Set objRSHO = Conn.Execute(strSQL)
strSQL = "SELECT COUNT(*) FROM tblSpel WHERE ligaid = " & intID & " AND hlag = 1 AND hmal < bmal"
Set objRSHF = Conn.Execute(strSQL)
strSQL = "SELECT Sum(hmal) FROM tblSpel WHERE ligaid = " & intID & " AND hlag = 1"
Set objRSHGJ = Conn.Execute(strSQL)
strSQL = "SELECT Sum(bmal) FROM tblSpel WHERE ligaid = " & intID & " AND hlag = 1"
Set objRSHIN = Conn.Execute(strSQL)[/red]
Och jag skriver ut med tabellen med:
[red]Do Until objRSH.EOF
Response.Write("Amica Wronki.....")
Response.Write objRSHM(0)
Response.Write(" ")
Response.Write objRSHV(0)
Response.Write(" ")
Response.Write objRSHO(0)
Response.Write(" ")
Response.Write objRSHF(0)
Response.Write(" ")
Response.Write objRSHGJ(0)
Response.Write(" - ")
Response.Write objRSHIN(0)
Response.Write(" ")
Response.Write FormatNumber(objRSHV(0)*3+objRSHO(0),0)
objRSH.Movenext
Loop[/red]
Nu är det såhär att jag vill skriva ut alla lag, och inte bara lag med lagid = 1.
Hoppas ni förstår, annars skriv vad ni inte förstår.