I have one table that has a non unique identifier and I need to update a corresponding column with a value from another table with a unique identifer.
Essentially I have two tables
Table1
| Col1 | Col2 |
---------------
| A | 1 |
---------------
| A | 2 |
---------------
| B | 4 |
---------------
| C | 6 |
---------------
| C | 9 |
---------------
Table2
| Col1 | Col2 |
---------------
| A | 1 |
---------------
| B | 2 |
---------------
| C | 3 |
---------------
I want to perform a calculation on Table1.Col2 with the corresponding values from Table2.Col2 where Table1.Col1 = Table2.Col1 using MySQL.
For Example:
| Col1 | Col2 |
---------------
| A | 1 | // (1/1)
---------------
| A | 2 | // (2/1)
---------------
| B | 2 | // (4/2)
---------------
| C | 2 | // (6/3)
---------------
| C | 3 | // (9/3)
---------------
Any help would be appreciated.