update email_fax set ef_faxresult=22 where ci_fax='$user_extension' and ef_type=5 and ef_intftime=(select max(ef_intftime) from email_fax where ci_fax='$user_extension')错误代码是 you can't specify target table 'email_fax' for update in from clause帮帮忙 这么写不可以的话应该怎么写 

解决方案 »

  1.   

    update email_fax set ef_faxresult=22 where ci_fax='$user_extension' and ef_type=5 and ef_intftime=(select max(ef_intftime) from email_fax where ci_fax='$user_extension')重新发下sql语句
      

  2.   

    意思是找最近时间的数据把faxresult改为22
      

  3.   

    把查询结果当where条件。。
    分开写吧。
      

  4.   


    update email_fax,
    (select max(ef_intftime) as max_intftime from email_fax where ci_fax='$user_extension') as email_fax1
     set ef_faxresult=22 where ci_fax='$user_extension' and ef_type=5 and ef_intftime=max_intftime
      

  5.   

    update email_fax set ef_faxresult=22 where ci_fax='$user_extension' and ef_type=5 and ef_intftime=(select max(e.ef_intftime) from email_fax as e where e.ci_fax='$user_extension')
      

  6.   

    很显然还是同样的错误, you can't specify target table 'email_fax' for update in from clause 
    不能这样写的主要原因在于,同一张表.
      

  7.   

    update email_fax set ef_faxresult=22 where ci_fax='$user_extension' and ef_type=5 order by ef_intftime desc limit 1