Last active
March 14, 2017 09:34
-
-
Save WinstonN/28f18270acc33a989750 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW customer_view AS | |
SELECT e.entity_id, | |
e.group_id, | |
e.store_id, | |
e.website_id, | |
e.email, | |
confirmation.value AS confirmation, | |
created_in.value AS created_in, | |
default_billing.value AS default_billing, | |
default_shipping.value AS default_shipping, | |
dob.value AS dob, | |
firstname.value AS firstname, | |
gender.value AS gender, | |
lastname.value AS lastname, | |
middlename.value AS middlename, | |
old_referral_rule_ids.value AS old_referral_rule_ids, | |
password_hash.value AS password_hash, | |
prefix.value AS prefix, | |
reward_update_notification.value AS reward_update_notification, | |
reward_warning_notification.value AS reward_warning_notification, | |
suffix.value AS suffix, | |
taxvat.value AS taxvat, | |
e.created_at, | |
e.updated_at | |
FROM customer_entity AS e | |
LEFT JOIN customer_entity_varchar AS confirmation ON (confirmation.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'confirmation') AND confirmation.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS created_in ON (created_in.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'created_in') AND created_in.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_int AS default_billing ON (default_billing.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'default_billing') AND default_billing.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_int AS default_shipping ON (default_shipping.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'default_shipping') AND default_shipping.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_datetime AS dob ON (dob.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'dob') AND dob.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS firstname ON (firstname.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'firstname') AND firstname.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_int AS gender ON (gender.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'gender') AND gender.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS lastname ON (lastname.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'lastname') AND lastname.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS middlename ON (middlename.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'middlename') AND middlename.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_text AS old_referral_rule_ids ON (old_referral_rule_ids.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'old_referral_rule_ids') AND old_referral_rule_ids.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS password_hash ON (password_hash.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'password_hash') AND password_hash.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS prefix ON (prefix.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'prefix') AND prefix.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_int AS reward_update_notification ON (reward_update_notification.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'reward_update_notification') AND reward_update_notification.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_int AS reward_warning_notification ON (reward_warning_notification.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'reward_warning_notification') AND reward_warning_notification.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS suffix ON (suffix.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'suffix') AND suffix.entity_id = e.entity_id) | |
LEFT JOIN customer_entity_varchar AS taxvat ON (taxvat.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = e.entity_type_id AND attribute_code = 'taxvat') AND taxvat.entity_id = e.entity_id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment