美文网首页
mysql:You can't specify target t

mysql:You can't specify target t

作者: 一梦三四年lyp | 来源:发表于2019-01-22 01:09 被阅读0次
    错误解释:
        大概意思是更新的字段在子查询中,导致报错,这时候加个中间吧就可以解决问题啦
    
    错误示范:
        update msedu_student.tb_student  SET hk_mc_id = '',id_card = '',taiwan_id = '',hk_mc_id = '' where id in (select id  from msedu_student.tb_student where (hk_mc_id regexp '[^\x00-\xff]'||id_card regexp '[^\x00-\xff]' || passport regexp '[^\x00-\xff]' || taiwan_id regexp '[^\x00-\xff]'))
        
    修改后示范
    
        UPDATE msedu_student.tb_student  SET hk_mc_id = '',id_card = '', taiwan_id = '',hk_mc_id = '' WHERE id IN (
        SELECT  id  FROM
        ( 
            SELECT id FROM msedu_student.tb_student WHERE ( hk_mc_id REGEXP '[^\x00-\xff]' || id_card REGEXP '[^\x00-\xff]' || passport REGEXP '[^\x00-\xff]' || taiwan_id REGEXP '[^\x00-\xff]')
        ) 
        as a
        ) 

    相关文章

      网友评论

          本文标题:mysql:You can't specify target t

          本文链接:https://www.haomeiwen.com/subject/nnykjqtx.html