Z
Z
Zorgios2019-07-30 14:58:37
MySQL
Zorgios, 2019-07-30 14:58:37

How to correctly transfer data from one table to another with a selection?

There are 2 tables:
armor
________________
| id | parameter |
------------------
player
______________
| id1 | id2 | armor |
The id1 and id2 tables of the player store the id from the armor table
And it is necessary to put the sum of the parametr values ​​from the armor table depending on the values ​​of id1 and id2 into the value of the armors column of the player table, i.e
.: take the parameter value of id=id1, add it to the parameter value of id =id2 and put the amount in armors

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Zhikhor, 2019-07-30
@Zorgios

if I understand you correctly.
php-noteki.ru/php-nachinayushhim/108-insert-selec...
or use foreign keys
https://metanit.com/sql/mysql/2.5.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question