Magento one of the best CMS for e-commerce website creation. Today I’m going to share some cool queries by which you will get detail of your sale product with its Increment Id, Buyer Name and Email address.Magento DB structure is very complex, if i”m not wrong then when you install magento then you will get 250 – 270 tables in your database. Where many tables hold your product catalog details and as like what type product and category of product and all. In magento you will get all sold product data/details in some tables and the name of those tables are
Those tables hold all details of your sold product. Now it’s time of db query for get all product data from database by fire a single query.
SELECT sales_flat_order.entity_id,sales_flat_quote_address.firstname, sales_flat_quote_address.lastname,sales_flat_quote_address.email,sales_flat_order_grid.increment_id FROM sales_flat_order LEFT JOIN sales_flat_quote_address ON sales_flat_quote_address.quote_id = sales_flat_order.quote_id LEFT JOIN sales_flat_order_grid ON sales_flat_order_grid.entity_id = sales_flat_order.entity_id WHERE sales_flat_quote_address.address_type = ['your address type'] ORDER by sales_flat_order.entity_id desc
When you fire this query in your database then you will get all sold product details with your customer number in descending form.
If you like this then share and like this on my fb page. 🙂