无冬之夜2阵营:谁能帮我把下面的两个记录集合并为只要一个记录查询?大部分代码重复了

来源:百度文库 编辑:高考问答 时间:2024/04/29 13:49:50
<%for i=1 to 31
balltmp(i)=1
lostcount(i-1)=0
lostmax(i-1)=0
next
do while not rs2.eof
if rs2(2)=""then rs2.movenext
balltmp(0)=0
for i= 0 to 2
temp = cInt(Mid(rs2(2), 1 + i * 2, 1)) + i * 10 + 1
balltmp(0)=balltmp(0)+balltmp(temp)
balltmp(temp)=0
next '排列三各个数位此处循环止
for i=1 to 30
if balltmp(i)>lostmax(i) then
lostmax(i)=balltmp(i)
end if
if balltmp(i)=0 then
lostcount(i)=lostcount(i)+1
end if
next
for i=1 to 31
balltmp(i)=balltmp(i)+1
next
rs2.movenext
loop
%>
<!--------------------------------------------second select-->
<%for i=1 to 31
balltmp(i)=1
'lostcount(i-1)=0
lostmax(i-1)=0
next
do while not rs1.eof
if rs1(2)=""then rs1.movenext
balltmp(0)=0
for i= 0 to 2
temp = cInt(Mid(RS1(2), 1 + i * 2, 1)) + i * 10 + 1
balltmp(0)=balltmp(0)+balltmp(temp)
balltmp(temp)=0
next '排列三各个数位此处循环止
%>
<tr bgcolor="#E1FFC4">
<td align=center><%=rs1(0)%></td>
<td align=center><span class="style2"><%=trim(replace(rs1(2),",",""))%></span></td>
<%for i=1 to 30
if balltmp(i)=0 then
%>
<td align=center bgcolor="<%if i>10 and i<=20 then response.write"#D0D0D0"%>"><font color="#0099FF"><%="●"%></font> </td>
<%else%>
<td align=center bgcolor="<%if i>10 and i<=20 then response.write"#D0D0D0"%>"><%=balltmp(i)%> </td>
<%end if
next%>
<td align=center><%=balltmp(0)-3%> </td>
</tr>
<%for i=1 to 31
balltmp(i)=balltmp(i)+1
next
rs1.movenext
loop%>
上面代码是对一个标进行查询的,先要显示最大值、符合条件的次数等,然后再显示每一条记录,需要两次查询数据库的同一个表。第一次查结果,第二次显示记录。

单独编写一个用于查询的函数,然后分别调用这个函数就可以了

一条sql语句可以查两个库的。。