select tbl2.* from tbl2, tbl1 where tbl1.A_id=tbl2.B_id,tbl1.A_name=tbl2.B_name,tbl1.A_time=tbl2.B_time,tbl1.A_job=tbl2.B_job

解决方案 »

  1.   

    楼上的大哥,我照你说的做了。可是有错误,你看一下代码:
    <?
    session_start();
    include 'mysql.inc.php';
    ?>
    <?
     include("DB_MYSQL.INC"); 
     $db=new DB_Sql;
     $db->query("select tbl2.* from tbl2, tbl1 where tbl1.A_id=tbl2.B_id,tbl1.A_name=tbl2.B_name,tbl1.A_time=tbl2.B_time,tbl1.A_job=tbl2.B_job
    ");?>
            <?while($db->next_record()):?>
            <tr bgcolor="#f7faf3">
              <td width="5%" height="5"> 
                <input type="checkbox" name="checkbox" value="checkbox">
              </td>
              <td width="11%" height="5"><font size="1" face="宋体">
                <? echo $db->f(0) ?>
                </font></td>
              <td width="20%" height="5"><font size="1" face="宋体"> <a href=jobview.php?job_sn=<? echo $db->f(1) ?>> 
                <? echo $db->f(2) ?>
                </a></font> </td>
              <td width="16%" height="5"><font size="1" face="宋体"> 
                <?echo $db->f(3); ?>
                </font></td>
              <td width="25%" height="5" bgcolor="#f7faf3"><font size="1" face="宋体"> 
                <?echo $db->f(1);?>
                </font> </td>
            </tr>
            <? endwhile ?>
      

  2.   

    代码是以上的,出现这样的错误:
    Database error: Invalid SQL: select job_info.* from job_info,p_register where p_register.p_knowledge=job_info.knowledge,p_register.p_specialty1=job_info.specialty
    MySQL Error: 1064 (You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'p_register.p_specialty1=job_info.specialty' at line 1)
    Session halted.
      

  3.   

    select tbl2.* from tbl2, tbl1 where tbl1.A_id=tbl2.B_id and tbl1.A_name=tbl2.B_name and tbl1.A_time=tbl2.B_time and tbl1.A_job=tbl2.B_job
      

  4.   

    ,改为AND 就OK了,但是数组取错了。从表里取出的字段不匹配,好象实现不了比较,它是把TBL2全部数据都写出来。tbl1.A_id=tbl2.B_id and tbl1.A_name=tbl2.B_name and tbl1.A_time=tbl2.B_time and tbl1.A_job=tbl2.B_job这段好象没起作用啊。