Running a query in MySQL updates only the first row in the tb_zgrading_21 table, how to fix it?

 UPDATE tb_zgrading_21 SET tb_zgrading_21.`Баллы` = (((SELECT `Вес квалификационного требования в %` FROM `tb_weightqualreq_21` WHERE tb_weightqualreq_21.`ID` = 1) * (SELECT `Баллы` FROM `tb_1gknowledgelevel` WHERE tb_1gknowledgelevel.`ID` = tb_zgrading_21.`Уровень знаний`))/100)+ (((SELECT `Вес квалификационного требования в %` FROM `tb_weightqualreq_21` WHERE tb_weightqualreq_21.`ID` = 2) * (SELECT `Баллы` FROM `tb_1gexperience` WHERE tb_1gexperience.`ID` = tb_zgrading_21.`Опыт`))/100)+ (((SELECT `Вес квалификационного требования в %` FROM `tb_weightqualreq_21` WHERE tb_weightqualreq_21.`ID` = 3) * (SELECT `Баллы` FROM `tb_1gcontentwork` WHERE tb_1gcontentwork.`ID` = tb_zgrading_21.`Содержание работы`))/100)+ (((SELECT `Вес квалификационного требования в %` FROM `tb_weightqualreq_21` WHERE tb_weightqualreq_21.`ID` = 4) * (SELECT `Баллы` FROM `tb_1gresponsibility` WHERE tb_1gresponsibility.`ID` = tb_zgrading_21.`Материальная ответственность`))/100)+ (((SELECT `Вес квалификационного требования в %` FROM `tb_weightqualreq_21` WHERE tb_weightqualreq_21.`ID` = 5) * (SELECT `Баллы` FROM `tb_1gresponsibility2` WHERE tb_1gresponsibility2.`ID` = tb_zgrading_21.`Ответственность за условия труда`))/100)+ (((SELECT `Вес квалификационного требования в %` FROM `tb_weightqualreq_21` WHERE tb_weightqualreq_21.`ID` = 6) * (SELECT `Баллы` FROM `tb_1ginteraction` WHERE tb_1ginteraction.`ID` = tb_zgrading_21.`Взаимодействие`))/100)+ (((SELECT `Вес квалификационного требования в %` FROM `tb_weightqualreq_21` WHERE tb_weightqualreq_21.`ID` = 7) * (SELECT `Баллы` FROM `tb_1gleadership` WHERE tb_1gleadership.`ID` = tb_zgrading_21.`Лидерство`))/100); 

Here is the link to the SQL code:

https://pastebin.com/y9K5TP9B

  • I think so - add a where clause at the end of the script. You update the line for some amount of data, but where to update is not specified. And you get only one amount .. it should be in all cells of the Баллы column? - Valentyn Hruzytskyi
  • Yes. But where is the opposite specifying construction. - Timur
  • The idea is that the construct should calculate the sum for all the rows and the specified columns. But it does this only for the 1st line. I can not understand anything. - Timur
  • Then I agree with the question .. according to the idea everything should be updated - Valentyn Hruzytskyi
  • one
    This is very strange if it updates only one line. By the fact that it says here he has to update everything - Mike Nov.

0