I want to get SKU and Order ID from Magento database and I know how to get them individually. The problem is I need to get SKU for the product that the order id points towards. I can't figure out the relation between sales_order_flat_table and catalogue_product_entity. I think there are other tables in between that I am missing. May be I should use some id in sales_flat_order_table to get product id and then get SQL.

2 Answers 2


you should use also the following tables and fields in your query: sales_flat_order_item [quote_item_id]

sales_flat_quote_item [product_id]


the order items are not "product entity " but "order_items entity". The order item contains the product_id.

You are missing the sales_flat_order_item table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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