How to update mysql table without deleting existing content


Problem :

I have a mysql table mysql_table. There is a column Cid for category id. I already uploaded many data in that table.

In first row, i upload ~1~2~3~ in Cid
In second row, i upload ~3~5~ in Cid
In third row , I upload ~1~ in Cid

Now i want to update column Cid of table mysql_table without affecting existing data. I want to update each Cid column with 15~. So that i need final reasult as

first row , ~1~2~3~15~
second row, ~3~5~15~
third row, ~1~15~

How Can I achieve this using mysql update query ?



Solution :

You can use concat to update the existing column as

update mysql_table set Cid = concat(Cid,'15~');

Mysql Tutorials

Mysql Howto..

How to tally column values of multiple rows with pure mysql?

How to select last 3 minutes' records from MySQL with PHP

How to limit the MySQL Query with Ebean in Play Framework

How to pass the value of javascript into a PHP variable and stored into mysql database? [duplicate]

How to get the count of different categories from mysql database with php [closed]

How do I convert the following to insert into mysql?

how to store keywords/tags

How to get the right select/option selected from mysql-db

How to get records for the most recent complete 13 weeks?

how to list items of a mysql aggregate function within the column

Showing images from path in mysql database

How to populate HTML textbox with MySQL data

How to write LEFT OUTER JOIN on the same table in jOOQ?

How to test across multiple mysql schemas with PHPUnit?

How to use 'select ' in MySQL 'insert' statement

How to compare an escaped field in PHP/MySQL?

how to get subject names and total of missed homework in each subject from MySQL/PHP

How to insert long number in mysql

How to combine two sql queries from same table

How do I create a function to add to existing information?

How normal should my checkbox data be for storage in database

MySQL, How to add a points system? (stacking variables in a row.)

How to connect to MySQL database from Visual Basic 6

How to enable INNODB in mysql

How can I convert latin1 data to UTF8 on mysql insert or update?

I have installed WAMP Server on 192.168.1.104 System, How to connect MySql From other System Ex.: 192.168.1.5

How do I cast ENUMs to their integer values when selecting into an outfile in MySQL?

How to change default time zone in php

How to show this structured info from database using mySQL/PHP?

How to disable innodb in mysql?