mysql - split() 不适用于 mySQL join?

标签 mysql common-schema

我目前正在使用 mySQL 通用架构包以及 split() 函数,但我正在努力让 JOIN 查询正常工作?

set @script := "
    split({size:2000} :
        UPDATE world
        SET world.CountryName = (
            SELECT country.nicename 
            FROM country
            WHERE country.iso = world.Country
        )
    )
    {
        throttle 4;
        SELECT $split_total_rowcount AS 'rows updated so far';
    }
";
call common_schema.run(@script);

运行此查询时,它会生成以下内容:

#1644 - QueryScript error: [split() cannot deduce split table name. Please specify explicitly] at 34: "UPDATE world

设置世界.国家/地区

至于为什么我试图将我的 UPDATE 查询拆分为 block ,是因为它试图更新一个有 3M+ 行的表,并且在自己执行查询时遇到困难

最佳答案

请明确指定似乎是指使用此格式:

Multiple tables operations; explicit declaration of splitting table:

split (schema_name.table_name: statement operating on multiple tables)

statement;

https://shlomi-noach.github.io/common_schema/query_script_split.html

另请参阅explicit declaration .

关于mysql - split() 不适用于 mySQL join?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51237394/

相关文章:

php - 无法添加或更新子行: a foreign key constraint fails

php - 尝试使用 PHP 和 MySQL 获取节点的路径

php - 如何在 RecursiveArrayIterator 中打印表数据索引

php - mysql 锁定表导致某些插入随机失败

mysql - 使用 common_schema 库无法解析 json 数组值

mysql - 使用 common_schema 提取值不适用于嵌套 JSON

mysql - 为什么 SQL 禁止执行 SELECT 查询?