Reputation: 1
I have a MySql database, I want to copy everything that is in the "topic_last_post_subject" field into the "phpbb_topics" fields, if the "phpbb_topics" field is blank. I would like to use the phpMyAdmin SQL query tool to do this. I am not that familiar with the correct syntax, is this correct?
UPDATE `phpbb_topics` SET `topic_title`=`topic_last_post_subject`;
Upvotes: 0
Views: 1033
Reputation: 1856
Your query will update ALL rows. You only want to update the blank ones:
UPDATE phpbb_topics SET topic_title = topic_last_post_subject
WHERE topic_title IS NULL OR
topic_title = '';
Upvotes: 1