I have two MySQL tables, the first with an id, name and the second with an id (related to the id of the first table) and a value. I need to make a query that adds all the values with the same id from table 2 and shows it in a new column of table 1, in the row of its related id.
Table 1:
id | nombre
1 | silvia
2 | maria
3 | pedro
Table 2:
id | valores
1 | 4
1 | 7
2 | 51
2 | 6
3 | 9
3 | 14
Desired result:
id | nombre | valores sumados
1 | silvia | 11
2 | maria | 57
3 | pedro | 23