1 0 Archive | MySQL RSS feed for this section
post icon

How to remove white space in a mysql field?

Execute SQL Command

UPDATE Country set State_Name = TRIM(State_Name);

Where State_Name in function TRIM hold values with spaces, and TRIM Function removes any white spaces and update the field in same table.

Leave a Comment
post icon

How to copy selected fields from one table to another table in MySQL?

SQL command to copy filed(s) from first table (here “single”) to second table “bank” in field “bankname”.

INSERT INTO `bank` (`bankname`) SELECT distinct `bank` FROM `single`

Leave a Comment
post icon

Update MySQL data from two tables

update node_revisions one, content_news_image two
set one.image = two.image_value
where one.nid = two.nid


Ex 2

update tbl_news one, term_node two
set one.description = two.description
where one.vid = two.vid

tbl_news – name of the table to be updated
term_node – name of table which hold data
one.description – name of the field where data is going (being updated)
two.description – name of the field FROM where data is hold



Leave a Comment