MYSQL update with sentence if -


The requirement to create a sentence update is as follows:

  update table1 set Lp = 1, mpe = 0, pe = 0, f2_lp = 0, f1_lp = 0, mvlp = 0 (LP = 1) set LP = 0, MP = 1, pay = 0, F2_LP = 0, F1_LP = 0, MVPP = 0 set LP = 0, MP 0, PE = 0, F2_LP (MAP = 1) set LP = 0, MP, PA = 1, F2_LP = 0, F1_LP = 0, mvpp = 0 = 1, f1_lp = 0, if (f2_lp = 1) lp = 0, mpe = 0, pe = 0, f2_lp = 0, f1_lp = 1, mvlp = 0 if set (f1_lp = 1) lp = 0, mpe = 0, pe = 0, f2_lp = 0, f1_lp = 0, mvlp = 1 if (mvpl = 1)  

Just repeat this condition again, with the first condition. I usually recommend that you use case , but you might be able to:

  update table1 set lp = (lp = 1) , Mp2 = (mp2 = 1), mpe = (mpe = 1), f2_lp = (f2_lp = 1), f1_lp = (f1_lp = 1), mvlp = (mvlp = 1);  

This is not exactly what you want to describe:

  update table1 set lp = (when lp = 1 then 1 and 0 end), mp2 = (If when lp = 1 then 0 when mp2 = 1 then 1 and 0 end), MP = (when lp = 1 or mp2 = 1 then 0 when mpe = 1 then 1 else 0), f2_lp = (when lp = 1 or mp2 = 1 or mpe = 1 then 0 when f2_lp = 1 then 1 and end of end). . .  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -