How to update multiple columns with a single statement with multiple conditions
<p>I want to update a series of columns <code>Country1</code>, <code>Country2</code>... <code>Country 9</code> based on a comma delimited string of country names in column Country. I have done so with the following statment:</p>

<pre><code>cur.execute("\
            UPDATE t \
            SET Country1 = returnCommaDelimitedValue(Country,0),\
                Country2 = returnCommaDelimitedValue(Country,1),\
                ...
                Country10 = returnCommaDelimitedValue(Country,9),\
            WHERE Country IS NOT NULL\
            ;")
</code></pre>

<p>I also have a column named <code>Genre</code> in my tabe. Now I would like to update columns <code>Genre1</code>, <code>Genre2</code>... <code>Genre9</code> in the same statment. I think the statment would look something like:</p>

<pre><code>cur.execute("\
                UPDATE t \
                SET Country1 = returnCommaDelimitedValue(Country,0), Genre1 = returnCommaDelimitedValue(Genre,0)\
                    Country2 = returnCommaDelimitedValue(Country,1), Genre2 = returnCommaDelimitedValue(Genre,1)\
                    ...
                    Country10 = returnCommaDelimitedValue(Country,9), Genre10 = returnCommaDelimitedValue(Genre,9)\
                WHERE Country IS NOT NULL\
                AND Genre IS NOT NULL
                ;")
</code></pre>

<p>Is the statement correct?</p>