Curtis
Curtis

Reputation: 2704

split() not working with mySQL join?

I'm currently using the mySQL common schema package along with the split() function, but I'm struggling to get a working JOIN query to work?

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);

When running this query, it produces the following:

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

SET world.Country

As for why I'm trying to split my UPDATE query into chunks, is because it's trying to update a table that's got 3M+ rows & is struggling when doing the query on it's own

Upvotes: 0

Views: 27

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179364

Please specify explicitly appears to refer to using this format:

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

See also explicit declaration.

Upvotes: 0

Related Questions