Reputation: 42997
I have the following situation.
In a MySql database I have a posts table. This table contains the following 2 fields: post_modified and post_date
For each record present in the posts table I need set the value of post_modified field with the value into the post_date
How can I do a query that do this work on all the table records?
Tnx
Upvotes: 0
Views: 68
Reputation: 700562
You would just use an update
without a condition to update all records:
update posts set post_modified = post_date
Depending on the settings in the database an update without a condition might not be allowed. Then you would add a dummy condition just to tell the database that you actually want to change every record:
update posts set post_modified = post_date where 1 = 1
Upvotes: 1
Reputation: 1605
This query should do the job :
UPDATE posts SET post_modified=post_date;
Upvotes: 2