• mysql 一个较特殊的问题:You can't specify target table for update in FROM clause


    mysql 一个较特殊的问题:You can't specify target table for update in FROM clause
    即:不能先select出同一表中的某些值,再update这个表(在同一语句中),解决方案:查询时为表定义一个别名在取值
    eg:
    UPDATE 
      `EDMGR_FORM_BASICINFO` 
    SET
      `EDMGR_FORM_BASICINFO`.`BELONG_DOMAIN` = '' 
    WHERE `EDMGR_FORM_BASICINFO`.`C_TYPE` = 'Question' 
      AND `EDMGR_FORM_BASICINFO`.`PARENT_UID` = '24101479651ef4aa0b3a198099491771' 
      AND `EDMGR_FORM_BASICINFO`.`USER_TYPE` = 'TEACHER' 
      AND `EDMGR_FORM_BASICINFO`.`BELONG_DOMAIN` = 
      (SELECT 
        basic.CHILD_UID 
      FROM
        (SELECT 
          `EDMGR_FORM_BASICINFO`.`CHILD_UID` 
        FROM
          `EDMGR_FORM_BASICINFO` 
        WHERE `EDMGR_FORM_BASICINFO`.`BASIC_UID` = '85043510851f0bccad6bd96005630220') basic)
     
  • 相关阅读:
    导航
    占位
    django(一)
    进程与线程
    网络编程
    反射 单例模式
    面向对象及命名空间
    logging,包
    模块(二)os hashlib
    装饰器&递归
  • 原文地址:https://www.cnblogs.com/h07061108/p/mysql.html
Copyright © 2020-2023  润新知