3

I would like to get an MySQL report from the Magento database that displays the group prices for each SKU. If the group doesn't have a price, it should still show the group name and null or 0 for the price.

For example

SKU          Market          Price
C009910      Cincinnati      145.00
             Louisville      142.00
N7100074     Cincinnati      0
             Louisville      135.00

We use customer groups for market pricing. We import the data from our POS database and I want to make sure that data is getting imported correctly.

I USED to be SQL jockey...lost the touch over the years...

Steve

3

The following should give you what you want, note that the customer group will be null if there is no customer group price, but you could simply ignore that part or put an if similar to the price.

SELECT
    prod.sku,
    IF(gp.value IS NULL,0,gp.value),
    cg.customer_group_code
FROM
    catalog_product_entity as prod
LEFT JOIN
    catalog_product_entity_group_price AS gp
    ON
        gp.entity_id = prod.entity_id
LEFT JOIN
    customer_group AS cg
    ON
        cg.customer_group_id = gp.customer_group_id
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.