You can try this
UPDATE `user` SET age_min=age;
Вопрос
In mysql database in user
table. I have a field named age
but now I would like to move all the contents of age
field to newly created field named age_min
. How can I do that? Thanks in advance..
Решение
You can try this
UPDATE `user` SET age_min=age;
Другие советы
Simply do:
Update table set age=age_min;
It will replicate the value of the field age to the field age_min
try this qry...
update `user` set `age_min` = `age`;
This Should do:
UPDATE user SET age_min = age;
You could copy all of the data to the new column:
UPDATE `user` SET `age_men` = `age`
OR you could just rename the existing column:
ALTER TABLE `user` CHANGE `age` `age_min` int
(you may have to drop the new column you just created in order to run the above query, if so, do this: ALTER TABLE user DROP age_min
SQL Fiddle:
Run this query:
UPDATE `user` SET `age_min` = `age`