0

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

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");
4

1 回答 1

5

你有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'
                         );
于 2017-08-02T11:29:52.600 回答