我的查询没有给出magento 1.9数据库的预期结果:
SELECT
customer.email AS email,
company.value as comp
FROM customer_entity AS customer
JOIN customer_address_entity AS addressentity
ON customer.entity_id=addressentity.parent_id
LEFT JOIN customer_address_entity_varchar AS company
ON company.entity_id=addressentity.entity_id
WHERE
customer.store_id = 1 AND
company.attribute_id=24 AND
customer.email="this@mail.com"
它应该给我的电子邮件和公司价值为空,如果它不存在,但它给我什么,如果没有公司名称。
1条答案
按热度按时间mkshixfv1#
请对customer\u address\u entity表也使用左外联接,