I have a question that I can’t figure out how to get together.

I need to implement a query with changes to two values ​​with a sample. I have been trying for a long time and cannot understand how to put it together.

I just want it to happen

UPDATE ocenka SET ocenk=0 WHERE ocenk <60 AND ocenk=1 WHERE ocenk >60; SELECT *FROM ocenka 

But I can't do it.

  • 2
    And it does not work, what kind of nonsense you have in the condition? Why two conditions at once? - Vladimir Klykov
  • I need two conditions to be met. Can I do this consistently or together with aka? - Alexander
  • I sort of understood, you need to register the update twice with the value? - Alexander
  • How can your two conditions be fulfilled simultaneously? less than 60 and more than 60? the number or more or less, at the same time and more and less, it can not be. Further, what is this nonsense? ocenk <60 AND ocenk=1 Do you think that 1 may not be less than 60? - Vladimir Klykov
  • UPDATE ocenka SET ocenk = 0 where ocenk <60; UPDATE ocenka SET ocenk = 1 where ocenk> 60; So it will be right? - Alexander

1 answer 1

 UPDATE ocenka SET ocenk=IF(ocenk>60;1;0) WHERE ocenk!=60; 

Exactly what you explained in the commentary, if you still need to handle the situation for ocenc=60 , add exactly how, if you need to exclude ocenc=1 from processing, specify this in the commentary under the answer ...