Need uppate SQL in SQL within table
<p>I have 2 columns in my table <code>Office</code> (<code>Cust_id</code>, <code>customer</code>)</p>

<p>The data is like below, I want to update the <code>cust_id</code> for the customer who have nulls, because I got in late the <code>cust_id</code> in the table ,</p>

<p>EX: I need an update script to search the customer who has null <code>cust_id</code> and search the <code>cust_id</code> and update 
Here DDD customers (<code>cust_id = 4</code>) so i need a script to update that </p>

<pre><code>cust_id, Customer
1    AAA
2    BBB
3    CCC
null DDD
null EEE
4    DDD
5    CCC
7    EEE
</code></pre>

<p>Use <code>UPDATE</code> with a self-JOIN:</p>

<pre><code>UPDATE Office AS o1
JOIN Office AS o2 ON o1.Customer = o2.Customer
SET o1.cust_id = o2.cust_id
WHERE o1.cust_id IS NULL
AND o2.cust_id IS NOT NULL
</code></pre>

python