mysql:You can't specify target t

2019-01-22  本文已影响0人  一梦三四年lyp
错误解释:
    大概意思是更新的字段在子查询中,导致报错,这时候加个中间吧就可以解决问题啦

错误示范:
    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
    ) 
上一篇下一篇

猜你喜欢

热点阅读