2017-10-17 55 views
0

我想要SQL或表关系来找出在magento中做出特定订单的客户的性别。在magento中订购的客户的性别

+0

怎么样 '选择customer_prefix FROM sales_flat_order WHERE increment_id = “100000XXXX”;'' –

+0

列customer_prefix'为空。有没有其他方法可以从客户性别中获取? – Dilani

回答

0

在我的数据库,它是:

SELECT t0.entity_id, t1.value 
FROM customer_entity AS t0 
INNER JOIN (
    SELECT t2.entity_id, t2.value 
    FROM customer_entity_int AS t2 
    WHERE (t2.attribute_id = 18) 
) AS t1 
    ON (t0.entity_id = t1.entity_id) 

attribute_id = 18可能会有所不同。

你需要找到它:

SELECT t1.attribute_id, t1.attribute_code, t1.backend_type 
FROM eav_entity_type AS t0 
INNER JOIN eav_attribute AS t1 
    ON (t0.entity_type_id = t1.entity_type_id) 
WHERE (t0.entity_model = @p0) 
-- p0 = [customer/customer]