Skip to content
Advertisement

Update multiple in one query in mysql

I have a problem on how can I update multiple in mysql in just one query the flow here is just like these.

This will work and runs correctly

JavaScript

What I’ve tried

JavaScript

But the problem, it update all of my records into null even if the value of each column is not equal to 0000-00-00 since I’ve been using OR statement. It would be great if anybody could figure out, thank you so much in advance!.

Advertisement

Answer

JavaScript

PS. WHERE conditions are copied as-is.

PPS. I recommend to add WHERE clause which ensures that at least one column from table_columnX ones contains zero date also.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement