Topic: Help to optimize UPDATE
Colleagues help, whether it is possible UPDATE to wrap in one the code.
The table grid the such.
idwork, idday, h0, h1, h2, h3, h4
It is necessary 5 to replace all with zero in idwork=35. Other digits not to touch. It is a lot of lines, and h0... h23, too it is a lot of them. At me it turns out not beautifully. A cycle in the lines (now them here 3 lines idwork=35) and then a cycle 0. 23, total it turns out 72 UPDATE! (((((
UPDATE grid SET h0=0 WHERE idwork=35 AND idday=105 AND h0=5 UPDATE grid SET h1=0 WHERE idwork=35 AND idday=105 AND h1=5 UPDATE grid SET h2=0 WHERE idwork=35 AND idday=105 AND h2=5 ... And so 72 times
And can be under one hundred-two lines idwork=35 that there will be generally a nightmare with amount UPDATE.
The basis is designed so, it not about the new.
How it is possible to solve the task beautifully?