Cita:
Iniciado por i_e_s27
Mmmm a mi se me ocurrio algo asi:
Código:
Set rsRef = Server.CreateObject("ADODB.Recordset")
strSQLrsRef = "SELECT distinct ref FROM detalle"
rsRef.Open strSQLComboCategoria, adoCon, adOpenStatic, adLockOptimistic
'Obtenemos los codigos distinct ref:
EsPrimero = True
Do While NOT rsRef.EOF
If rsRef("distinct ref") <> Referencias Then
If EsPrimero = False Then Referencias = Referencias & ","
Referencias = Referencias & rsRef("distinct ref")
EsPrimero = False
End If
rsRef.MoveNext
Loop
Referencias = Split(Referencias, ",", -1, 1)
'Ahora por cada referencia hacemos una consulta:
For i=1 to uBound(Referencias)
Set rsProductos = Server.CreateObject("ADODB.Recordset")
strSQLrsProductos = "SELECT color, Count([T27]), SUM([T28]), SUM([T29]), SUM([T30]) from detalle WHERE distinct ref=" & Referencias(i)
rsProductos.Open strSQLComboCategoria, adoCon, adOpenStatic, adLockOptimistic
Response.Write(rsProductos("color") & ", " & rsProductos("T27") & ", " & rsProductos("T28") & ", " & rsProductos("T29") & ", " & rsProductos("T30"))
rsProductos.Close
Set rsProductos = Nothing
Next 'i
Aunque es lo mismo que te puso Myakire pero mas tedioso...
Tu decides cual te convenga mas!
Saludos!

Si lo he intentado y lo he modificado algo asi,,
[CODE]
<%
set rsRef1 = Server.CreateObject("ADODB.Connection")
rsRef1.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("pedidos.mdb"))
set rsRef = server.createobject("adodb.recordset")
tablo = "SELECT distinct ref FROM detalle"
rsRef.pagesize = 12000
rsRef.open tablo,rsRef1,1,3
'Obtenemos los codigos distinct ref:
EsPrimero = True
Do While NOT rsRef.EOF
If rsRef("ref") <> Referencias Then
If EsPrimero = False Then Referencias = Referencias & ","
Referencias = Referencias & rsRef("ref")
EsPrimero = False
End If
rsRef.MoveNext
Loop
Referencias = Split(Referencias, ",", -1, 1)
'Ahora por cada referencia hacemos una consulta:
For i=1 to uBound(Referencias)
Set rsProductos = Server.CreateObject("ADODB.Recordset")
tablox = "SELECT color, Count([T27]), SUM([T28]), SUM([T29]), SUM([T30]) from detalle WHERE distinct ref=" & Referencias(i)
rsProductos.open tablox,rsProductos,1,3
Response.Write(rsProductos("color") & ", " & rsProductos("T27") & ", " & rsProductos("T28") & ", " & rsProductos("T29") & ", " & rsProductos("T30"))
rsProductos.Close
Set rsProductos = Nothing
Next 'i
%>[CODE]
pero el iis me da el siguiente error!
Tipo de error:
ADODB.Recordset (0x800A0BB9)
Argumentos incorrectos, fuera del intervalo permitido o en conflicto con otros.
/asp/mhl/xxxx2.asp, línea 28
la linea 28 es:
rsProductos.open tablox,rsProductos,1,3
que enredo que me estoy haciendo,,