In some scenarios, we need to modify our varchar type fields, and the result of the modification is the concatenation of two fields or the concatenation of a field + a string. As shown below, we want to modify the name in the xx_role table to name+id. In MySQL, if we operate directly through "+", an error will be prompted. The operator "+" is used to add numbers. Here, the keyword concat is needed to indicate concatenation. Similarly, we can also use field + string to concatenate. Here we will briefly talk about the "+" operation, which is used to add numeric fields, as shown below: Supplement: Use update in mysql to update multiple fields at the same time, including select query Wrong attempts:update table name set (field 1, field 2, field 3, ...) = (select value 1, value 2, value 3, ...) where condition Correct way:# UPDATE OldData o, NewData n without using select SET o.name = n.name, o.address = n.address where n.nid=234 and o.id=123; # Using select situation UPDATE OldData o, (select name, address from NewData where id = 123) n SET o.name = n.name, o.address = n.address where n.nid=234; The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: 15 lines of CSS code can cause Apple devices to crash, and the latest iOS 12 is not immune
>>: How to enable remote access in Docker
Preface If you are going to interview for a Linux...
Table of contents Seconds_Behind_Master Original ...
It is very simple to build a kong cluster under t...
Problem description (environment: windows7, MySql...
environment System: Ubuntu 18.04 Software: qt5.12...
Table of contents Row-Column Conversion Analyze t...
The main symptom of the conflict is that the FLASH...
This article example shares the specific code of ...
CSS Styles html,body{ width: 100%; height: 100%; ...
Table of contents Matlab Centroid Algorithm As a ...
1. What is pip pip is a Python package management...
After adding –subnet to Docker network Create, us...
Table of contents 1. Structural instructions Modu...
What is Publish/Subscribe? Let me give you an exa...
This article shares with you how to use Vue to lo...