dim sql,rs,c
c=""
sql="select * from hjb order by id2 asc"
set rs=conn.execute(sql)
do while not rs.eof then
if rs("id2")<>c then
response.write rs("id2")&"户口信息"
end if
response.write rs("姓名")
c=rs("id2")
loop
set rs=conn.execute("select distinct id2 from hjb order by id2 asc")
if not rs.eof then do while not rs.eof response.write rs(0)&"户口信息:<br>" set rs1=conn.execute("select 姓名 from hjb where id2='"&rs(0)&"'") do while not rs1.eof response.write rs1(0) response.write "<br>" rs1.movenext loop rs.movenext loop
end if