SQL语句:那样写还不如这样写

 

那样写:

set rs=conn.execute("select * from Books")
while not rs.eof
rs2=conn.execute("select * from Authrs where AuthorID="&rs("AuthorID"))
Response.write rs("Title")&">>"&rs2("Name")
rs.movenext()
wend

 

这样写:

strSQL="SELECT Books.Title,Authors.Name FROM Books JOIN Authors ON Authors.AuthorID=Books.AuthorID"
set rs=conn.execute(strSQL)
while not rs.eof
Response.write rs("Title")&">>"&rs("Name")
rs.movenext()
wend

你可能感兴趣的:(sql语句)