[英]Change Mysql column Value
I have two question 我有两个问题
at first: 首先:
we have Table user
with column usergroupid
". I want to find all "2" values in this column and change to "1" 我们有表
user
,其列usergroupid
“。”我想在此列中找到所有“ 2”值,然后更改为“ 1”
and second question: 第二个问题:
How can I do change the value only for id's 100 > end, not do the change for first 100 id's 我该如何仅更改ID为100>结束的值,而不更改前100个ID为
User id's Column name userid
用户ID的列名
userid
Assuming userid are sequential and starts from 1, if you want to update usergroupid from 2 to 1 to the greater than 100 id you can try this 假设userid是连续的,并且从1开始,如果要将usergroupid从2更新为大于100的id,可以尝试以下操作
UPDATE user
SET usergroupid = 1
WHERE usergroupid = 2
AND userid > 100
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.