Home > front end >  Update about text-type field in mysql
Update about text-type field in mysql

Time:11-28

SQL statements: (make sure after two table association, id=29, the data is)
 update pip_plan p left join pip_dev_check c on p. erial_id=c.s. erial_num and p.c reate_time=Arthur c. reate_time 
The SET c.p hoto=CONCAT (' 1 ', c.p hoto, ' ')
Where the p.i d=29;


Return results: the influence lines of 0
Affected rows: 0, Time: 0.000000 s

Find problems found, the text type of field, a new data that the field is empty, the last a data as shown in figure,


Is (null), in this case the
 SET c.p hoto=CONCAT (' 1 ', c.p hoto, ' ') 
is invalid, but the
 SET c.p hoto='1' 
,

And if the initiative to modify the content of this field is blank, which data such as the way in article 2 of the first data,
 SET c.p hoto=CONCAT (' 1 ', c.p hoto, ' ') 
can perform,

To sum up, I want to ask next bosses, this is why, have what solutions,

CodePudding user response:

For: CONCAT_WS (' ', '1', NULL, ") will be a '1'


If you want to only in c.p hoto not null, can filter in the condition
  • Related