Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/04/2008, 05:32
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 4 meses
Puntos: 126
Re: Agrupar los resultados

Hola, prueba así

Código PHP:
set rs1 Server.CreateObject("ADODB.Recordset")
SQL "Select distinct referencias, color from tabla"
rs1.Open SQLoConn,3,1
do while not rs1.eof
%>
<%=
rs1("referencias")%> - <%=rs1("color")%>:
<%
set rs2 Server.CreateObject("ADODB.Recordset")
 
otra consulta ya sin registros repetidos
SQL 
"Select referencias, ref1, ref2, ref3, ref4 from tabla where referencias = "CInt(rs1("referencias")) &""
rs2.Open SQLoConn,3,1
Totalref1 
0
Totalref2 
0
Totalref3 
0
Totalref4 
0
do while not rs2.eof
Totalref1 
=  Totalref1 rs2("ref1")
Totalref2 =  Totalref2 rs2("ref2")
Totalref3 =  Totalref3 rs2("ref3")
Totalref4 =  Totalref4 rs2("ref4")
rs2.Movenext
loop
%>
<%=
Totalref1%> - <%=Totalref2%> - <%=Totalref3%> - <%=Totalref4%><br />
<%
rs2.Close
set rs2
=nothing
rs1
.Movenext
loop
rs1
.Close
set rs1
=nothing
oConn
.Close
set oConn
=nothing 
Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />

Última edición por Adler; 05/04/2008 a las 14:09 Razón: Faltaba una cosillas