Home > database >  Mysql query conditions
Mysql query conditions

Time:11-28

Now there is a demand, modify the data by id, when a change is to see if a column the data have a certain value, if not, modify

How to implement

Example:
I have a site list, there is a enable fields, two data, one of which enable to 0, a is 1, I now modify which enable to 1, because there is only one enable to 0, what should I write SQL

Another way is to modify the data, other data can enable 0, can be successful

CodePudding user response:

UPDATE SITE SET need to modify the field='you want to change the target WHERE the enable=1;
  • Related