我使用相同的查询从一个数据库转移到另一个数据库多年,但突然间我收到了错误
“操作数应包含1列”
这是我的SQL:
INSERT INTO lightand_expressionengine.exp_channel_data (
entry_id
, site_id
, channel_id
, field_id_1
, field_ft_1
, field_id_3
, field_ft_3
, field_id_7
, field_ft_7
, field_id_8
, field_ft_8
, field_id_9
, field_ft_9
, field_id_11
, field_ft_11
, field_id_12
, field_ft_12
, field_id_13
, field_ft_13
, field_id_14
, field_ft_14
, field_id_16
, field_ft_16
, field_id_17
, field_ft_17
)
SELECT (
entry_id
, site_id
, channel_id
, field_id_1
, field_ft_1
, field_id_3
, field_ft_3
, field_id_7
, field_ft_7
, field_id_8
, field_ft_8
, field_id_9
, field_ft_9
, field_id_11
, field_ft_11
, field_id_12
, field_ft_12
, field_id_13
, field_ft_13
, field_id_14
, field_ft_14
, field_id_16
, field_ft_16
, field_id_17
, field_ft_17
)
FROM lightand_expressionengineold.exp_channel_data
任何人都可以看到问题所在吗?我无法弄明白。
答案 0 :(得分:2)
从(...)
删除开始和结束括号,即SELECT
。即尝试以下SQL。
INSERT INTO lightand_expressionengine.exp_channel_data (
entry_id
, site_id
, channel_id
, field_id_1
, field_ft_1
, field_id_3
, field_ft_3
, field_id_7
, field_ft_7
, field_id_8
, field_ft_8
, field_id_9
, field_ft_9
, field_id_11
, field_ft_11
, field_id_12
, field_ft_12
, field_id_13
, field_ft_13
, field_id_14
, field_ft_14
, field_id_16
, field_ft_16
, field_id_17
, field_ft_17
)
SELECT
entry_id
, site_id
, channel_id
, field_id_1
, field_ft_1
, field_id_3
, field_ft_3
, field_id_7
, field_ft_7
, field_id_8
, field_ft_8
, field_id_9
, field_ft_9
, field_id_11
, field_ft_11
, field_id_12
, field_ft_12
, field_id_13
, field_ft_13
, field_id_14
, field_ft_14
, field_id_16
, field_ft_16
, field_id_17
, field_ft_17
FROM lightand_expressionengineold.exp_channel_data