split()无法与MySQL连接一起使用?

时间:2018-07-09 01:54:20

标签: 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

SET world.Country

关于我为何尝试将UPDATE查询拆分为大块的原因,是因为它试图更新具有3M +行并且在自行执行查询时很费力的表

1 个答案:

答案 0 :(得分:0)

Please specify explicitly似乎是指使用以下格式:

  

多个表操作;拆分表的显式声明:

     

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

     

statement;

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

另请参阅explicit declaration