Ho fatto così:
codice:
Set RS = Server.CreateObject("ADODB.Recordset")
sql = " select VisitProven from tbl_sessioni "
sql = sql & " where VisitProven <> '' "
RS.Open sql, objConn, 3, 3
Do While NOT RS.EOF
sSQL = "SELECT "
sSQL = sSQL & " VISITPROVEN, "
sSQL = sSQL & " SUM(VISITORCOUNT) "
sSQL = sSQL & " AS VISITORCOUNT "
sSQL = sSQL & " FROM tbl_SESSIONI "
sSQL = sSQL & " WHERE VISITPROVEN = '"& RS("VisitProven") &"' "
sSQL = sSQL & " GROUP BY VISITPROVEN"
set oRS = objconn.execute(sSQL)
strSQL = "INSERT INTO tbl_stat"
strSQL = strSQL & " ("
strSQL = strSQL & "VisitProven,"
strSQL = strSQL & "VisitorCount)"
strSQL = strSQL & " VALUES "
strSQL = strSQL & "("
strSQL = strSQL & "'"& RS("VisitProven") &"',"
strSQL = strSQL & ""& oRS("VISITORCOUNT") &""
strSQL = strSQL & ") "
set objRS = objconn.execute(strSQL)
RS.MoveNext
Loop
Ma per ogni records della query select sSQL mi inserisce un record nella tbl_stat che contiene il totale di VisitProven...
Dove sbaglio?