<%   
   '读出数据库
   dim myconn,connstr,rs,sql,i
   Set myconn=Server.CreateObject("ADODB.Connection")
   connstr="Driver={SQL server};Server=sm;Database=110date;UID=sa;PWD=005"
   Set rs=Server.CreateObject("ADODB.RecordSet")
   sql="select * from smaj,hlfjaj where smaj.date='2006-6-1' and hlaj.date='2006-6-1'"
   myconn.open connstr
   rs.open sql,myconn,3,3   while (not rs.eof)
   response.write rs("dq")
   rs.movenext()
   wend
%>   数据库里有两张表smaj,hlaj,表里的字段是相同,经过上述查询后,如何才能只读出smaj里的字段?谢谢

解决方案 »

  1.   

    sql 可以改为 select select smaj.* from smaj,hlfjaj where smaj.date='2006-6-1' and hlaj.date='2006-6-1'"
      

  2.   

    sql="select smaj.* from smaj,hlfjaj where smaj.date=hlaj.date and hlaj.date='2006-6-1'"注意后面的条件的更改
    之前你写的是有问题的
      

  3.   

    select smaj.* from smaj,hlfjaj where smaj.date=hlaj.date and smaj.date='2006-6-1'
      

  4.   

    谢谢,那如果查完要分别显示出smaj和hlaj内字段dq的值要怎么样办呢??
      

  5.   

    select smaj.dq,hlaj.dq from smaj,hlfjaj where smaj.date=hlaj.date and smaj.date='2006-6-1'?
      

  6.   

    sql 可以改为 select select smaj.* from smaj,hlfjaj where smaj.date='2006-6-1' and hlaj.date='2006-6-1'" 不要给我分了 只用在百事创意大赛上
    http://jay.pepsi.163.com/article.jsp?id=16255
    点击"我也要帮他评分" 用163邮箱登陆 给我评分
    我还差几票
      

  7.   

    问题没出在SQL语句上,问题在于楼主的输出语句上response.write rs("dq")改成response.write rs("dq") & " " & rs("你要显示的其它字段名1") & " " & rs("..其它字段名n")
      

  8.   

    不可能
    ,应当是两个表date='2006-6-1'的记录 的笛卡尔积