Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I need to update a row in my mysql database, but i don't want to replace the data that is already stored in it. example:

select books from storedb where id='Rick';

result of the query: Books = "example1"

but i need to update that row and add more books.

update storedb set books='example2' where id='Rick';

but it replaces the current data, so i need to do it without replacing current data. somethink like this: books='example1 -- example2";

share|improve this question

1 Answer 1

up vote -1 down vote accepted

so you need a string concatenation? Try this:

update storedb set books=CONCAT(books,' -- ', 'example2') where id='Rick';
share|improve this answer
    
Thanks a lot, it worked!. –  OverHead 2 hours ago
    
No problem, could you please accept this answer then? Thanks –  Florian 1 hour ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.