Allora, la unica query potrebbe essere questa:
codice:
Query = " SELECT "
Query = Query & " ir, uo, "
Query = Query & " count(*) as tot_ir, "
Query = Query & " sum(if(uo='91',1,0)) as tot_91, "
Query = Query & " sum(if(uo='93',1,0)) as tot_93, "
Query = Query & " sum(if(uo='95',1,0)) as tot_95, "
Query = Query & " sum(if(uo='96',1,0)) as tot_96 "
Query = Query & " FROM tbl_fraser "
Query = Query & " GROUP BY ir "
Query = Query & " ORDER BY ir ASC "
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open Query, connCount
if not Rs.eof then
Rs.MoveFirst()
Do While Not Rs.EOF
response.write "Tot IR = " & Rs("ir") & " ===> " & Rs("tot_ir") & "
"
response.write "Tot UO_91 = " & Rs("uo") & " ===> " & Rs("tot_91") & "
"
response.write "Tot UO_93 = " & Rs("uo") & " ===> " & Rs("tot_93") & "
"
response.write "Tot UO_95 = " & Rs("uo") & " ===> " & Rs("tot_95") & "
"
response.write "Tot UO_96 = " & Rs("uo") & " ===> " & Rs("tot_96") & "
"
Rs.MoveNext()
Loop
end if
Però non mi riesce di impaginare il risultato, infatti ho questo:
Tot IR = - ===> 4
Tot UO_91 = 95 ===> 0
Tot UO_93 = 95 ===> 2
Tot UO_95 = 95 ===> 1
Tot UO_96 = 95 ===> 1
Tot IR = IMI ===> 4
Tot UO_91 = 93 ===> 2
Tot UO_93 = 93 ===> 1
Tot UO_95 = 93 ===> 0
Tot UO_96 = 93 ===> 1
Tot IR = IRE ===> 4
Tot UO_91 = 91 ===> 3
Tot UO_93 = 91 ===> 1
Tot UO_95 = 91 ===> 0
Tot UO_96 = 91 ===> 0
Tot IR = MAN ===> 3
Tot UO_91 = 95 ===> 0
Tot UO_93 = 95 ===> 0
Tot UO_95 = 95 ===> 2
Tot UO_96 = 95 ===> 1
Tot IR = VAS ===> 1
Tot UO_91 = 93 ===> 0
Tot UO_93 = 93 ===> 1
Tot UO_95 = 93 ===> 0
Tot UO_96 = 93 ===> 0
Invece che questo:
Tot IR = - ===> 4
Tot UO_91 = 91 ===> 0
Tot UO_93 = 93 ===> 2
Tot UO_95 = 95 ===> 1
Tot UO_96 = 96 ===> 1
Tot IR = IMI ===> 4
Tot UO_91 = 91 ===> 2
Tot UO_93 = 93 ===> 1
Tot UO_95 = 95 ===> 0
Tot UO_96 = 96 ===> 1
Tot IR = IRE ===> 4
Tot UO_91 = 91 ===> 3
Tot UO_93 = 93 ===> 1
Tot UO_95 = 95 ===> 0
Tot UO_96 = 96 ===> 0
Tot IR = MAN ===> 3
Tot UO_91 = 91 ===> 0
Tot UO_93 = 93 ===> 0
Tot UO_95 = 95 ===> 2
Tot UO_96 = 96 ===> 1
Tot IR = VAS ===> 1
Tot UO_91 = 91 ===> 0
Tot UO_93 = 93 ===> 1
Tot UO_95 = 95 ===> 0
Tot UO_96 = 96 ===> 0
:master: