In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you how to modify the contents of data table fields in batches in MySQL, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
How to modify the field contents of MySQL data table in batches
In PHPwind6.0 's database, its membership information is stored in pw_members, and the "yz" field in this data table normally shows a value of 1 (that is, the account has been activated). If you need to activate the mail again, the value must be the same as the value of the other field "regdate". The program automatically detects whether the contents of the two fields are exactly the same before it is validated, otherwise it will give a prompt for a parameter error. For example, if the content of the "regdate" field of the member UID1 is 1194067635, then the value of the "yz" field is also 1194067635; and so on, if the "regdate" field content of the member UID2 is 1175320740, then the value of the "yz" field is also 1175320740.
At this point, due to a variety of possible reasons, the value of the "yz" field may not all be 1 (that is, the account has been activated). How to keep the value of the "yz" field consistent with the content of the "regdate" field? At the same time, because there are many member information, how to convert this field value of all member accounts in batches? The method I use is like this.
UPDATEtableSET replaced field name = copied field name
Apply to this article example: UPDATEpw_membersSETyz=regdate
Where "pw_members" is the name of the data table; "replaced field name" refers to the name of the field you want to modify in "pw_members", here is "yz"; and "copied field name" refers to the field name that provides the field content to the "yz" field to copy (good mouthful yo!) "regdate"; so that the "yz" in each UID can be modified and copied to the same value as "regdate". The next time a member logs in, the community will ask him to activate his email account again.
Since this is a batch modification, all accounts, including community creators, will be changed to inactive, so when the implementation is finished, change the accounts that do not need to be activated, including community creators, back to normal immediately. The method is to browse the pw_members data sheet, select the member account you want to change back to the normal state, click "Edit" to enter the "yz" field, and change the value of the field, such as "1194067635" to "1", so that the member account will return to normal; you can also use the administrator account to enter the community management backstage "member management" to manually activate the required member ID.
How to modify the field contents of MySQL data table in batches
In addition, how to manually convert the content between different fields in the same data table in batch, you can refer to the following command:
UPDATEtableset field name = REPLACE (field name, 'original string', 'replaced string') Field name known to where LIKE'% original string%'
Apply to an example of this article:
UPDATEpw_memberssetyz=REPLACE (yz,'1','2') whereyzLIKE'%1%'
Where "pw_members" is the name of the data table; "field name" refers to the name of the field you want to modify in "pw_members", here is "yz"; "original string" is the field "yz" now the default value "1"; and "replacement string" refers to the field you are going to modify "yz" the new default value "2".
The above is how to modify the contents of data table fields in batches in MySQL. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.