this is my sql statement:
SQLstr="SELECT tkinit,tkfirst,tklast,tkloc,ldesc,tkdept,head1,tksect,tsectdes,mclient,clname1,"
SQLstr=SQLstr& " right(mmatter,5) as matter,mdesc1,"
SQLstr=SQLstr& " (arf1 + arc1 + aro1 + ari1) as one,"
SQLstr=SQLstr& " (arf2 + arc2 + aro2 + ari2) as two,"
SQLstr=SQLstr& " (arf3 + arc3 + aro3 + ari3) as three,"
SQLstr=SQLstr& " (arf4 + arc4 + aro4 + ari4) as four,"
SQLstr=SQLstr& " (arf5 + arc5+ aro5 + ari5 + arf6 + arc6 + aro6 + ari6) as five,"
SQLstr=SQLstr& " (arf1 + arc1 + aro1 + ari1) + (arf2 + arc2 + aro2 + ari2) + (arf3 + arc3 + aro3 + ari3) + (arf4 + arc4 + aro4 + ari4) + (arf5 + arc5+ aro5 + ari5 + arf6 + arc6 + aro6 + ari6) as ttl"
SQLstr=SQLstr& " FROM matter, df_dwmatter, client, timekeep, tsection, deptlab, location"
SQLstr=SQLstr& " WHERE (matter.mclient = client.clnum) and (timekeep.tkinit = matter.mbillaty) and"
SQLstr=SQLstr& " (mmatter = matter) and (tsection.tsection = tksect) and (deptlab.delcode = timekeep.tkdept) and"
SQLstr=SQLstr& " (timekeep.tkloc = location.locode) and"
SQLstr=SQLstr& " (matter.mmatter in (SELECT udf.udjoin FROM udf WHERE (udf.udfindex = 55) AND (udf.udvalue IS NULL OR udf.udvalue = 'U')) OR"
SQLstr=SQLstr& " matter.mclient in (SELECT udf.udjoin FROM udf WHERE (udf.udfindex = 197) AND (udf.udvalue IS NULL OR udf.udvalue = 'U'))) and"
SQLstr=SQLstr& " ((arf1 + arc1 + aro1 + ari1 +arf2 + arc2 + aro2 + ari2 + arf3 + arc3 + aro3 + ari3 + arf4 + arc4 + aro4 + ari4 + arf5 + arc5+ aro5 + ari5 + arf6 + arc6 + aro6 + ari6) > 2500) AND"
SQLstr=SQLstr& " df_dwmatter.pe = " & rs2("pe"

& " and"
SQLstr=SQLstr& " tkdept ='" & dept & "' AND"
SQLstr=SQLstr& " tkloc <>'50' AND tkloc<>'51'"
SQLstr=SQLstr& " ORDER BY tsectdes,mclient"
response.Write SQLstr
set rs=dbConn.execute(SQLstr)
and this is my loop to right out the html
do while not rs.eof
strDispName=rs("tsectdes"
locDesc= rs("ldesc"

dept=rs("head1"
intTotPts1=intTotPts1 + rs("one"

intTotPts2=intTotPts2 + rs("two"

intTotPts3=intTotPts3 + rs("three"

intTotPts4=intTotPts4 + rs("four"

intTotPts5=intTotPts5 + rs("five"

intTotPtsttl=intTotPtsttl + rs("ttl"
if strFullName=strDispName then
else
response.Write intTotPts1 & intTotPts2 & intTotPts3 & intTotPts4 & intTotPts5
response.Write "<BR>"
if intTotPts1 > 0 or intTotPts2 >0 or intTotPts3 >0 or intTotPts4 >0 or intTotPts5 >0 or intTotPtsttl > 0 then
response.write "<tr bgcolor=" & rspaleyellow & "><td class=home2textB>" & rs("tsectdes"

& "</td>"
response.write "<td class=home2text>" & formatcurrency(intTotPts1,2)& "</td>"
response.write "<td class=home2text>" & formatcurrency(intTotPts2,2) & "</td>"
response.write "<td class=home2text>" & formatcurrency(intTotPts3,2) & "</td>"
response.write "<td class=home2text>" & formatcurrency(intTotPts4,2) & "</td>"
response.write "<td class=home2text>" & formatcurrency(intTotPts5,2) & "</td>"
response.write "<td class=home2text>" & formatcurrency(intTotPtsttl,2) & "</td>"
response.write "</tr>"
end if
intTotPts1=0
intTotPts2=0
intTotPts3=0
intTotPts4=0
intTotPts5=0
intTotPtsttl=0
strFullName=strDispName
end if
'if Not strTLoc=rs("tkloc"

then
' if intFirst=1 then
' response.write "<tr><td height=40> </td></tr>"
' end if
' intSpace=0
' response.write "<Table align=center width=10% cellspacing=0 cellpadding=3><tr><td class=home2textb align=""center"" nowrap>" & locDesc & "</td></tr></table>"
'end if
'if Not strFullName=strDispName then
' response.write "<tr><td class=home2textb colspan=7>Total</td></tr>"
'end if
'if intQF=1 then
' if rs("one"

> 0 and rs("two"

>0 and rs("three"

>0 and rs("four"

>0 and rs("five"

>0 and rs("ttl"

>0 then
' intDisp=0
' else
intDisp=1
' end if
'end if
if intDisp=0 then
if Not strFullName=strDispName then
response.write "<table style=""border:solid " & tableborder & " 1px"" align=""center"" width=""95%"">"
response.write "<tr class=tablehead2><td class=home2textb colspan=7>" & dept & "</td>"
response.write "</tr>"
response.write "<tr class=tablehead>"
response.write "<th width=""25%"">Matter Resp Attorney/Matter</th>"
response.write "<th>30 Days of Less</th>"
response.write "<th>31-60 Days</th>"
response.write "<th>61-90 Days</th>"
response.write "<th>91-120 Days</th>"
response.write "<th>120 Days of More</th>"
response.write "<th>Net Outstanding</th>"
response.write "</tr>"
end if
if v=1 then
bgcolor=rsgreyll
v=0
else
bgcolor="#ffffff"
v=1
end if
if Not strFullName=strDispName then
response.write "<tr bgcolor=" & bgcolor & " class=home2text valign=top>"
response.write "<td>" & rs("tsectdes"

& "</td>"
response.write "<td>" & formatcurrency(rs("one"

,2) & "</td>"
response.write "<td>" & formatcurrency(rs("two"

,2) & "</td>"
response.write "<td>" & formatcurrency(rs("three"

,2) & "</td>"
response.write "<td>" & formatcurrency(rs("four"

,2) & "</td>"
response.write "<td>" & formatcurrency(rs("five"

,2) & "</td>"
response.write "<td>" & formatcurrency(rs("ttl"

,2) & "</td>"
response.write "</tr>"
end if
'running totals
end if
intSpace=1
intFirst=1
strTLoc=rs("tkloc"

'strFullName=strDispName
rs.movenext
loop
I am able to right out the subgroups 1 time(if there are three there will be there rows. The problem i cannot get the running totals for each of the sub group to adde up right