高手帮忙整合2条查询!(完成立刻结单)
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 合并2个查询... </title>
</head>
<body>
<%
set rs=server.createobject( "adodb.recordset ")
sqltext= "select * from table1 order by retime desc "
rs.open sqltext,conn,1,1%>
<TABLE cellSpacing=1 cellPadding=4 width= "99% " height= "32 " class= "text ">
<TBODY>
<tr>
</form>
</tr>
<table cellspacing= "1 " cellpadding= "0 " width= "985 " align= "center " border= "0 " class= "a3 " >
<tr c>
<td align= "center " height= "22 " class= "a1 ">
工作单号 </td>
<td align= "center " height= "22 " class= "a1 ">
客户 </td>
<td align= "center " height= "22 " class= "a1 ">
数量 </td>
<td align= "center " height= "22 " class= "a1 ">
时间 </td>
<td align= "center " height= "22 " class= "a1 ">
号码 </td>
</tr>
<%
if not rs.eof then
i=0
do while not rs.eof
%>
<td width= "75 " align= "center " height= "23 " class= "a3 " > <%=rs( "id ")%>
<td width= "110 " align= "center " height= "23 " class= "a3 "> <%=rs( "custom ")%>
</td>
<td width= "76 " align= "center " height= "23 " class= "a3 "> <%=rs( "total ")%> </td>
<td width= "87 " align= "center " height= "23 " class= "a3 "> <%=rs( "retime ")%> </td>
<td width= "124 " align= "center " height= "23 " class= "a3 "> <%
dim rs8
dim sql8
sql8= "select * from table2 where moneyid= ' "&rs( "id ")& " ' "
Set rs8 = Server.CreateObject( "ADODB.Recordset ")
rs8.open sql8,conn,1,1
if rs8.eof and rs8.bof then
response.write "号码暂空。 "
else
%>
<textarea rows= "4 " name= "S1 " cols= "24 " > <%=rs8( "haoma ")%> /
<% rs8.movenext
do while not rs8.eof
%> <%=rs8( "haoma ")%> /
<%
rs8.movenext
loop
end if
rs8.close
set rs8=nothing%> </textarea> </td>
</tr>
</table>
</TD>
</tr>
<TR>
<TD class=main1 width= "968 " height= "27 ">
<p align= "center ">
</TD> </TR>
<TR>
<TD class=main1 width= "968 " height= "4 " > </TD> </TR> </TBODY> </TABLE> <br>
</center>
</div>
<div align= "center ">
<table border= "0 " cellPadding= "0 " cellSpacing= "0 " width= "100% " class=a1>
<tr> <td >
</center>
</td> </tr>
</table>
<%rs.close
set rs=nothing
conn.close
set conn=nothing%>
</body>
</html>
TABLE1和TABLE2的2个查询,我分开写了,虽然可以正常查询,但是我总感觉不好.
高手能不能帮忙合并起来,由于学的不精,只学会简单查询,复杂点的合并查询又不懂.
[解决办法]
不好意思,少加了个逗号。。。。
Select t1.*,t2.haoma From ....
t1和t2是表的别名,为了写语句的方便。
