There is a table with columns x, y, z It is necessary to check each line, that if in a line the value of the field y = i then add several lines with the same values ​​of x, z, but with another y, and check if there is no such line

Example:

Исходная таблица: xyz 1 2 3 5 6 7 Итоговая таблица: xyz 1 2 3 5 6 7 1 45 3 1 38 3 5 68 7 5 23 7 
  • Add to the question what has happened so far. - 0xdb
  • Sample source data. The desired result with such data. The reason why. Their attempts, explanations, why so. Where is all this? And in the query the only difficulty is how to add to the table from which you choose. But he is easily solvable. - Akina
  • insert ignore into table(x,y,z) select x, 45, z from table where y=2 if there is a unique key on the table from columns x, y, z. And so for each new value. or complicate select and force it to generate such strings from the list of new values - Mike
  • thanks, really everything just turned out - Igor Ostanin

0