Set rs = Server.CreateObject("ADODB.Recordset")
sql="SELECT SUM(carrello.quantita) AS qt, prodotti.marca,prodotti.prezzoscontato,prodotti.id categoria,prodotti.idsottocategoria FROM carrello,prodotti where carrello.idprodotto=prodotti.idprodotto GROUP BY prodotti.prezzoscontato,prodotti.marca,prodotti.id categoria,prodotti.idsottocategoria ORDER BY prodotti.prezzoscontato desc"
Set rs=Conn.Execute(SQL)
for kk=0 to 4
if not rs.eof then
sql2="SELECT categoria FROM categoria where idcategoria="&rs("idcategoria")
Set rs2=Conn.Execute(SQL2)
sql3="SELECT sottocategoria FROM sottocategoria where idsottocategoria="&rs("idsottocategoria")
Set rs3=Conn.Execute(SQL3)
%>
<tr><td class="testoelenco"><%=UCASE(rs2("categoria")&"/"&rs3("sottocategoria")&"/"&rs("marca"))%></td><td class="testoora"><%=UCASE(rs("qt"))%></td><td class="testoora"><%=FormatNumber(rs("qt")*rs("prez zoscontato"),2)%></td></tr>
<%rs.movenext
end if
next