Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 MySql 数据库,如果“phpbb_topics”字段为空,我想将“topic_last_post_subject”字段中的所有内容复制到“phpbb_topics”字段中。我想使用 phpMyAdmin SQL 查询工具来执行此操作。我对正确的语法不是很熟悉,这是正确的吗?
UPDATE `phpbb_topics` SET `topic_title`=`topic_last_post_subject`;
您的查询将更新所有行。您只想更新空白的:
UPDATE phpbb_topics SET topic_title = topic_last_post_subject WHERE topic_title IS NULL OR topic_title = '';