MySQL - 从其他 table 插入行时,操作数应包含 1 列
MySQL - Operand should contain 1 column(s) when insert row from other table
在我正在创建的系统上工作时,我试图在我的项目中使用以下查询:
INSERT INTO wpr9_posts ( `post_date`,`post_content`,`post_title`,`post_status`,`post_type` )
VALUES ((SELECT '2020-08-28 18:30:43' as post_date,`image`,`name`,'publish' as post_status,'post' as post_type FROM `play` WHERE `catid` = 863 ))
此查询将行从 table 插入到另一个 table。
是否有简单的解决方法或其他方式来编写我的查询?
使用 insert-select 语句时不需要 values
关键字:
INSERT INTO wpr9_posts ( `post_date`,`post_content`,`post_title`,`post_status`,`post_type` )
SELECT '2020-08-28 18:30:43' as post_date,`image`,`name`,'publish' as post_status,'post' as post_type FROM `play` WHERE `catid` = 863
在我正在创建的系统上工作时,我试图在我的项目中使用以下查询:
INSERT INTO wpr9_posts ( `post_date`,`post_content`,`post_title`,`post_status`,`post_type` )
VALUES ((SELECT '2020-08-28 18:30:43' as post_date,`image`,`name`,'publish' as post_status,'post' as post_type FROM `play` WHERE `catid` = 863 ))
此查询将行从 table 插入到另一个 table。
是否有简单的解决方法或其他方式来编写我的查询?
使用 insert-select 语句时不需要 values
关键字:
INSERT INTO wpr9_posts ( `post_date`,`post_content`,`post_title`,`post_status`,`post_type` )
SELECT '2020-08-28 18:30:43' as post_date,`image`,`name`,'publish' as post_status,'post' as post_type FROM `play` WHERE `catid` = 863