How to update a MySQL table column without erasing the existing data -


i have table ticket column comments. want mysql query can add values comments without erasing stored data. new data should added in new line.

for example if present content of coloumns table abc , new data def should update database def(in 1st line) , abc (in second line)

i have used below query. works here hitting database abc;def

update ticket  set comments = concat( coalesce( comments ) , 'def' )  ticket_id =235; 

here ticket_id primary key.

i assume want put new line or carriage return , newline combination in separator.

just newline

update ticket set comments  = concat('def', coalesce(concat(char(10),comments),'')) ticket = 25; 

or crlf:

update ticket set comments  = concat('def', coalesce(concat(char(13),char(10),comments),'')) ticket = 25; 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -