53

I have a table with the following column & value:

ColA = "8765" ColB = "2137"

I would like to update ColB in the same table to the following value:

ColC = "[8765][2137]"

How can I do it using phpmyadmin (meaning just sql syntax)?

3 Answers 3

88
UPDATE table SET ColC = CONCAT("[", ColA, "][", ColB, "]");
Sign up to request clarification or add additional context in comments.

Comments

15
UPDATE
    myTable
SET
    ColC = CONCAT('[', ColA, '][', ColB, ']')
--WHERE...

Comments

2

Use only this one! I've tested on the live server.

UPDATE table SET column_name = CONCAT( Column_A, ' ', Column_A );

In between single quotes will add a space. You can remove that if it is not required.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.