How can I make a copy values from one column to another?
I have:
Database name: list
-------------------
number | test
-------------------
123456 | somedata
123486 | somedata1
232344 | 34
I want to have:
Database name: list
----------------
number | test
----------------
123456 | 123456
123486 | 123486
232344 | 232344
What MySQL query should I have?
Short answer for the code in question is:
Here
tableis the table name and it’s surrounded by grave accent (aka back-ticks `) as this is MySQL convention to escape keywords (andTABLEis a keyword in that case).BEWARE!
This is pretty dangerous query which will wipe everything in column
testin every row of your table replacing it by thenumber(regardless of it’s value)It is more common to use
WHEREclause to limit your query to only specific set of rows: