Skip to content

Instantly share code, notes, and snippets.

@stnc
Forked from cagartner/magento.sql
Created December 11, 2018 00:03
Show Gist options
  • Save stnc/c11bdcf69a2c8f25e157473556c5ec4f to your computer and use it in GitHub Desktop.
Save stnc/c11bdcf69a2c8f25e157473556c5ec4f to your computer and use it in GitHub Desktop.
MYSQL RAW SELECTS FOR MAGENTO
# Get Customers taxvat
SELECT ce.*, ea.attribute_code, cev.value
FROM customer_entity AS ce
LEFT JOIN eav_attribute AS ea ON ce.entity_type_id = ea.entity_type_id AND ea.backend_type = 'varchar'
LEFT JOIN customer_entity_varchar AS cev ON ce.entity_id = cev.entity_id AND ea.attribute_id = cev.attribute_id
WHERE ea.attribute_code = 'taxvat';
# Get Customer Data from orders
SELECT `increment_id`, `customer_id`, `customer_firstname`, `customer_email`, `customer_taxvat` FROM `sales_flat_order`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment