#1241 - 操作数应包含 1 列 - 为什么我会得到这个?



我正在尝试运行查询,但出现上述错误。 谁能告诉我为什么我得到它。

UPDATE `catalog_eav_attribute`
SET `used_for_sort_by` = 1
WHERE attribute_id = (
SELECT * FROM `eav_attribute` WHERE `entity_type_id` = (SELECT `entity_type_id` FROM `eav_entity_type` WHERE `entity_model` = "catalog/product") AND `attribute_code` = "created_at");

你有attribute_id = (select * . . .. 据推测,eav_attribute有多个列。

您需要指定特定列,如下所示:

UPDATE `catalog_eav_attribute`
SET `used_for_sort_by` = 1
WHERE attribute_id = (SELECT ea.attribute_id  -- this is a guess
FROM `eav_attribute` ea
WHERE `entity_type_id` = (SELECT `entity_type_id` 
FROM `eav_entity_type` 
WHERE `entity_model` = 'catalog/product'
) AND
`attribute_code` = 'created_at'
);

相关内容

  • 没有找到相关文章

最新更新