UPDATE
TABLE_1
SET
COL_1 = (
SELECT
SUM(TOT)
FROM
TABLE_2
)
WHERE
CUST_NO = TABLE_2.CUST_NO
So, this is my SQL so far. Essentially, I am trying to update COL_1 in TABLE_1 to be the sum of the TOT stored in TABLE_2. I am trying to update this on the CUST_NO from both tables.
I know my code doesn't work at all, but I really have no idea how to do this.
So an example of one row from TABLE_1 before I run my SQL would be:
|CUST_NO |COL_1|
|1000 |null |
|1001 |null |
And TABLE_2:
|CUST_NO |TOT |
|1000 |15 |
|1000 |17 |
|1001 |13 |
|1001 |12 |
And what I ultimately want/need:
TABLE_1:
|CUST_NO |COL_1|
|1000 |32 |
|1001 |25 |