我想知道每个sku
中有多少unspsc
个。有人可以帮忙吗?
SELECT eav.value AS 'unspsc', e.sku
FROM catalog_product_entity e
JOIN catalog_product_entity_varchar eav
ON e.entity_id = eav.entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE ea.attribute_code = 'unspsccode'
答案 0 :(得分:0)
SELECT eav.value AS 'unspsc',COUNT( e.sku)
FROM catalog_product_entity e
JOIN catalog_product_entity_varchar eav
ON e.entity_id = eav.entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE ea.attribute_code = 'unspsccode'
GROUP BY eav.value