我把代码发上来,帮我看看
<%
set rs=server.createobject("adodb.recordset")
set rs1=server.createobject("adodb.recordset")
sql="select dep_name,'b'=count(*) from sum group by dep_name"
rs.open sql,conn,1,1
%>
<table align="center" width="23%" border="1" cellspacing="0" cellpadding="4" bordercolor="#C0C0C0" style="border-collapse: collapse">
<tr>
<td width="29%" align="center">处</td>
<td width="38%" align="center">部门</td>
<td width="33%" align="center">数量(台)</td>
</tr><%
do while not rs.eof
if rs1.state=1 then rs1.close
sql1="select * from sum where dep_name='"&rs("dep_name")&"'"
rs1.open sql1,conn,1,3
if rs("b")>1 then
%>
<tr>
<td rowspan="<%=rs("b")%>"><%=rs("dep_name")%></td>
<td><%=rs1("dep_section")%></td>
<td><%=rs1("sum")%></td>
</tr><%rs1.move 1
do while not rs1.eof
%>
<tr>
<td><%=rs1("dep_section")%></td><td><%=rs1("sum")%></td>
</tr><%
rs1.movenext
loop
else
%><%
do while not rs1.eof
%>
<tr>
<td><%=rs1("dep_name")%></td>
<td><%=rs1("dep_section")%></td>
<td><%=rs1("sum")%></td>
</tr><%
rs1.movenext
loop
end if
rs.movenext
loop
%>
</table>