【问题标题】:Magento: query to export product without category + attribute VISIBILITYMagento:查询以导出没有类别+属性可见性的产品
【发布时间】:2014-09-19 06:38:05
【问题描述】:

我有一个查询要选择所有与某个类别无关的产品。 这里查询:

SELECT cpe.entity_id, cpe.sku
FROM catalog_product_entity as cpe
LEFT JOIN catalog_category_product as ccp
on cpe.entity_id = ccp.product_id
WHERE category_id IS NULL

现在我会看到属性 visibility 的值(目录、搜索、目录和搜索,单独不可见

此属性值在此表上:catalog_productentity_ind,其中属性 id 为 89。

SELECT *
FROM `catalog_product_entity_int`
WHERE `attribute_id` =89

现在我将显示类别为 NULL 的属性值 (attribute_id=89),如下例所示:

产品编号 |产品 SKU |属性值 (id 89) |类别(全部为 NULL)

我该怎么做?

【问题讨论】:

    标签: sql magento


    【解决方案1】:
    SELECT cpe.entity_id, cpe.sku, cpe_int.value as visibility 
    FROM catalog_product_entity as cpe
    LEFT JOIN catalog_category_product as ccp
    on cpe.entity_id = ccp.product_id
    LEFT JOIN catalog_product_entity_int as cpe_int
    ON cpe.entity_id = cpe_int.entity_id
    AND cpe_int.attribute_id = 89
    WHERE ccp.category_id IS NULL
    

    【讨论】:

    • 可以工作,但第一行有语法错误:在“可见性”一词之后没有逗号......比工作完美。
    • 刚刚修好了。谢谢。
    猜你喜欢
    • 2013-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-25
    • 1970-01-01
    相关资源
    最近更新 更多