首页 > 解决方案 > 得到一个 MySQL 语法错误,不知道为什么

问题描述

我试图通过使用此命令将我的文章表中的标题和内容列中的数据从数据库复制到来自不同数据库的 wp_posts 列中的 wp_title 和 wp_content 列。

INSERT INTO wp_seetheuniverse.dbo.wp_posts ('wp_title', 'wp_content')
SELECT 'title', 'content' FROM seetheuniverse.dbo.articles;

这是我得到的错误,不知道为什么。

ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '.wp_posts ('wp_title', 'wp_content') SELECT
'title', 'content' FROM seetheuniver' at line 1

标签: mysqldatabase

解决方案


使用以下查询:

INSERT INTO dbo.wp_posts (wp_title,wp_content) 从 dbo.articles 中选择标题、内容;

其中 dbo 是数据库名称,wp_posts 和文章是表。


推荐阅读