0

I need to select all the attributes of the products these columns of all products in the tables:

Any suggestion?

--

TABLE: catalog_product_entity

COLUMN: sku

--

TABLE: catalog_product_index_price

COLUMN: price

--

TABLE: cataloginventory_stock_status

COLUMN: qty

COLUMN: stock_status

--

TABLE: catalog_product_index_price

COLUMN: price

2
  • What have you got so far?
    – Adi
    Sep 24, 2015 at 14:26
  • Now, i have this: SELECT entity_id as product_id, sku, qty as quantidade, stock_status as estoque FROM catalog_product_entity INNER JOIN cataloginventory_stock_status ON (cataloginventory_stock_status.product_id = entity_id) Sep 24, 2015 at 14:50

1 Answer 1

1

Ready, I got it.

Just use:

SELECT DISTINCT catalog_product_entity.entity_id, sku, price as preco, qty as quantidade, stock_status as estoque FROM catalog_product_entity INNER JOIN cataloginventory_stock_status ON (cataloginventory_stock_status.product_id = entity_id) INNER JOIN catalog_product_index_price ON (catalog_product_index_price.entity_id = catalog_product_entity.entity_id)
2
  • 1
    Cool! Three things to mention here: 1) you could use LEFT JOIN instead of INNER JOIN if you want to catch situations where a product doesn't have stock or price 2) the query works for single store Magento installations; if you have more than one store you might want to add AND catalog_product_index_price.website_id=$websiteId to the second join 3) you might be interested in catalog_product_index_price.final_price field also since that's the actual selling price.
    – Adi
    Sep 25, 2015 at 8:30
  • Btw, it's perfectly fine to mark your own answer as the accepted answer, so please feel free to do so if it solves the original question :)
    – Adi
    Sep 25, 2015 at 8:33

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.