I don't know if the title is clear but I'll try to explain it here. We have thousands of record for our database and there are a couple of datetime columns in theses tables. We have to move to int using unix_timestamp but I can't figure out a query in MySQL that would update these fields.
Let's say I have a simple table with a field like that :
user_table :
id : int,
name : string,
date_joined : datetime;
To change all of these date_joined filed to a int I thought adding a int column and copying the date as a int into the new column then drop the old column and rename my new column could be a solution. I built a little php script my script will then make thousands of MySQL query which is quite long. My script would run queries like :
UPDATE user_table SET date_joined_int=UNIX_TIMESTAMP(date_joined) where id = 1
...
Is this possible to do this with one MySQL query?